* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #333;
}

.hidden {
  display: none !important;
}

/* --- 地図 --- */
#map {
  width: 100%;
  height: 100%;
}

/* --- FABボタン --- */
.fab {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  font-size: 16px;
  font-weight: bold;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 28px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.4);
  -webkit-appearance: none;
  white-space: nowrap;
}

.fab:active {
  opacity: 0.9;
  transform: translateX(-50%) scale(0.97);
}

/* --- Aboutリンク --- */
.about-link {
  position: fixed;
  top: 80px;
  left: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  color: #888;
  font-size: 16px;
  font-weight: bold;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.about-link:hover {
  color: #4a90d9;
  border-color: #4a90d9;
}

/* --- 情報バー --- */
#info-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  color: #333;
  z-index: 1000;
  border-top: 1px solid #ddd;
  flex-wrap: wrap;
}

#info-bar span {
  white-space: nowrap;
}

#room-status {
  font-weight: bold;
}

/* --- オーバーレイ共通 --- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

/* --- エラーオーバーレイ --- */
#error-message {
  background: white;
  padding: 32px;
  border-radius: 8px;
  max-width: 400px;
  text-align: center;
  font-size: 16px;
  color: #333;
}

/* --- パスワードダイアログ --- */
#password-dialog {
  background: white;
  padding: 32px;
  border-radius: 8px;
  max-width: 320px;
  width: 90%;
  text-align: center;
}

#password-dialog p {
  font-size: 14px;
  color: #333;
  margin-bottom: 16px;
}

#password-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 12px;
  -webkit-appearance: none;
}

#password-input:focus {
  outline: none;
  border-color: #4a90d9;
}

#password-error {
  margin-top: 8px;
  font-size: 13px;
  color: #c62828;
}

/* --- マーカーラベル --- */
.sender-label {
  background: white;
  border: 1px solid #666;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

/* --- トラッキングバー --- */
.tracking-bar {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
  z-index: 1002;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

.tracking-bar.all {
  background: #43a047;
  color: #fff;
}

.tracking-bar.individual {
  background: #1e88e5;
  color: #fff;
}

.tracking-bar.none {
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
}

.tracking-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

#tracking-cancel {
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.8;
}

#tracking-cancel:hover {
  opacity: 1;
}

/* --- センダーパネル --- */
#sender-panel {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  border: 1px solid #ddd;
  z-index: 1000;
  min-width: 180px;
  max-width: 260px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#sender-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
}

#sender-panel-title {
  font-size: 13px;
  font-weight: bold;
  color: #333;
}

#sender-panel-toggle {
  background: none;
  border: none;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  padding: 0 4px;
}

#sender-list {
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
}

#sender-panel.collapsed #sender-list {
  display: none;
}

#sender-panel.collapsed #sender-panel-toggle {
  transform: rotate(-90deg);
}

.sender-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  border-top: 1px solid #eee;
}

.sender-item:hover {
  background: #f0f0f0;
}

.sender-item.tracking {
  background: #e3f2fd;
}

.sender-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sender-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sender-item-time {
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
}

.sender-item-mode {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.sender-item-mode.realtime {
  background: #e8f5e9;
  color: #2e7d32;
}

.sender-item-mode.manual {
  background: #f5f5f5;
  color: #888;
}

/* --- 送信ドロワー --- */
#sender-drawer {
  position: fixed;
  bottom: 34px;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid #ddd;
  border-radius: 16px 16px 0 0;
  z-index: 1001;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

#sender-drawer.collapsed #drawer-content {
  display: none;
}

#sender-drawer.collapsed #drawer-handle {
  display: none;
}

#sender-drawer.collapsed #drawer-label {
  display: inline !important;
}

#drawer-header {
  cursor: pointer;
  text-align: center;
  padding: 6px 16px;
}

#drawer-handle {
  width: 36px;
  height: 4px;
  background: #ccc;
  border-radius: 2px;
  margin: 2px auto 0;
}

#drawer-label {
  font-size: 13px;
  font-weight: bold;
  color: #4a90d9;
  letter-spacing: 0.5px;
}

#drawer-content {
  padding: 0 16px 16px;
}

.drawer-row {
  margin-bottom: 12px;
}

.drawer-row label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 4px;
}

.drawer-row input {
  width: 100%;
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  -webkit-appearance: none;
}

.drawer-row input:focus {
  outline: none;
  border-color: #4a90d9;
}

.drawer-section {
  margin-bottom: 12px;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* --- モード切替 --- */
.mode-toggle {
  display: flex;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.mode-btn {
  flex: 1;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: bold;
  border: none;
  background: #fff;
  color: #888;
  cursor: pointer;
  -webkit-appearance: none;
}

.mode-btn.active {
  background: #4a90d9;
  color: #fff;
}

/* --- 位置表示 --- */
.location-display {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  margin-bottom: 10px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
}

.location-display.has-location {
  color: #333;
  font-family: "SF Mono", "Menlo", "Monaco", monospace;
  font-size: 13px;
}

/* --- ボタン共通 --- */
.btn {
  display: block;
  width: 100%;
  padding: 10px;
  font-size: 15px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  -webkit-appearance: none;
}

.btn:active {
  opacity: 0.8;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.6;
}

.btn-primary {
  background: #4a90d9;
  color: #fff;
}

.btn-secondary {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
}

.btn-danger {
  background: #c62828;
  color: #fff;
}

.btn-danger-outline {
  background: #fff;
  color: #c62828;
  border: 1px solid #e0b0b0;
}

.btn-small {
  flex: 1;
  padding: 8px;
  font-size: 13px;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-row .btn {
  margin-bottom: 0;
}

/* --- ステータス --- */
.status {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.status.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.status.error {
  background: #fbe9e7;
  color: #c62828;
}

/* --- モーダル --- */
#room-modal {
  background: white;
  border-radius: 12px;
  max-width: 380px;
  width: 90%;
  padding: 20px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: #888;
  cursor: pointer;
  line-height: 1;
}

.modal-tabs {
  display: flex;
  border-bottom: 2px solid #eee;
  margin-bottom: 16px;
}

.modal-tab {
  flex: 1;
  padding: 10px;
  font-size: 15px;
  font-weight: bold;
  border: none;
  background: none;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  -webkit-appearance: none;
}

.modal-tab.active {
  color: #4a90d9;
  border-bottom-color: #4a90d9;
}

.modal-panel .form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 4px;
}

.form-group .optional {
  font-weight: normal;
  color: #888;
  font-size: 12px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  -webkit-appearance: none;
}

.form-group input:focus {
  outline: none;
  border-color: #4a90d9;
}

.modal-status {
  margin-top: 8px;
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}

.modal-status.error {
  color: #c62828;
}

/* --- TTL選択 --- */
.ttl-options {
  display: flex;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.ttl-btn {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  font-weight: bold;
  border: none;
  background: #fff;
  color: #888;
  cursor: pointer;
  -webkit-appearance: none;
}

.ttl-btn.active {
  background: #4a90d9;
  color: #fff;
}

/* --- 最近の部屋 --- */
.recent-rooms-title {
  font-size: 12px;
  font-weight: bold;
  color: #888;
  margin-top: 16px;
  margin-bottom: 6px;
}

.recent-rooms-list {
  list-style: none;
}

.recent-room-item {
  padding: 8px 10px;
  font-size: 14px;
  font-family: "SF Mono", "Menlo", "Monaco", monospace;
  color: #4a90d9;
  cursor: pointer;
  border-radius: 4px;
}

.recent-room-item:hover {
  background: #f0f4fa;
}

/* --- #password-submit (in modal context, btn already styled) --- */
#password-submit {
  width: 100%;
  margin-top: 4px;
}
