:root {
  --bg: #fdfaf3;
  --ink: #2f2a24;
  --accent: #ff8a5b;
  font-family: "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

.app-header {
  text-align: center;
  padding: 18px 12px 10px;
  position: relative;
}

.app-header h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: 0.05em;
}

.app-header .sub {
  margin: 4px 0 0;
  font-size: 1rem;
  color: #6b6155;
}

.mode-toggle {
  position: absolute;
  top: 16px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 2px solid #e7ddcd;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: bold;
  color: #6b6155;
  cursor: pointer;
}

.mode-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

main {
  padding: 8px 14px 140px;
  max-width: 780px;
  margin: 0 auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.dest-card {
  position: relative;
  border: none;
  border-radius: 22px;
  padding: 16px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,0.12);
  transition: transform 0.08s ease;
  font-family: inherit;
}

.dest-card:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.12);
}

.dest-card .icon-wrap {
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.dest-card .icon-wrap svg {
  width: 100%;
  height: 100%;
}

.dest-card .label {
  font-size: 1.15rem;
  font-weight: bold;
  text-align: center;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.dest-card .kana {
  font-size: 0.72rem;
  opacity: 0.9;
}

.dest-card .badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  font-weight: bold;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border: 2px solid var(--accent);
}

.dest-card.selected .badge {
  display: flex;
}

.dest-card.selected {
  outline: 4px solid #2f2a24;
  outline-offset: 2px;
}

.schedule-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 2px solid #e7ddcd;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}

.schedule-bar-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.schedule-list {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  min-height: 46px;
  align-items: center;
}

.schedule-list .chip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f3ede0;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.schedule-list .chip .num {
  font-weight: bold;
  color: var(--accent);
}

.show-btn, .clear-btn {
  flex: none;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: bold;
  cursor: pointer;
}

.show-btn {
  background: var(--accent);
  color: #fff;
}

.show-btn:disabled {
  background: #ddd3c2;
  color: #948a7a;
  cursor: not-allowed;
}

.clear-btn {
  background: #efe8db;
  color: #6b6155;
}

.overlay {
  position: fixed;
  inset: 0;
  background: #fffaf0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
  z-index: 50;
}

.overlay-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #efe8db;
  font-size: 1.6rem;
  color: #6b6155;
  cursor: pointer;
}

.overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.overlay-icon {
  width: min(52vw, 280px);
  height: min(52vw, 280px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.12);
}

.overlay-icon svg { width: 100%; height: 100%; }

.overlay-label {
  font-size: min(11vw, 3.4rem);
  font-weight: bold;
  text-align: center;
}

.overlay-kana {
  font-size: 1.3rem;
  color: #6b6155;
}

.overlay-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-btn {
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 14px 22px;
  cursor: pointer;
}

.overlay-counter {
  font-size: 1rem;
  color: #6b6155;
  font-weight: bold;
}

.speak-again-btn {
  border: 2px solid var(--accent);
  background: #fff;
  color: var(--accent);
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
}

@media (max-width: 420px) {
  .app-header h1 { font-size: 1.5rem; }
  .mode-toggle .mode-label { display: none; }
}
