:root { --primary: #1565c0; --accent: #43a047; --bg: #e3f2fd; --soft: #bbdefb; }
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 20px;
  font-family: 'Zen Maru Gothic', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.back-btn {
  position: absolute;
  top: 10px;
  left: 15px;
  padding: 8px 15px;
  background: rgba(255,255,255,0.95);
  text-decoration: none;
  color: #333;
  font-weight: bold;
  border-radius: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  z-index: 20;
  font-size: 0.9rem;
}
.container {
  background: #fff;
  border-radius: 20px;
  padding: 24px 20px 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  text-align: center;
  margin-top: 36px;
}
h1 {
  font-size: 1.4rem;
  color: var(--primary);
  margin: 0 0 8px;
}
.lead {
  font-size: 0.95rem;
  color: #666;
  margin: 0 0 18px;
  line-height: 1.5;
}
.mode-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.mode-btn {
  flex: 1;
  min-width: 90px;
  padding: 12px 8px;
  border: 3px solid var(--soft);
  background: #e8f4ff;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  color: #0d47a1;
}
.mode-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.region-panel {
  display: none;
  margin-bottom: 14px;
  padding: 12px 8px;
  background: #e8f4ff;
  border-radius: 14px;
  border: 2px dashed var(--soft);
}
.region-panel.show { display: block; }
.region-label {
  font-size: 0.9rem;
  font-weight: bold;
  color: #0d47a1;
  margin-bottom: 10px;
}
.region-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.region-btn {
  padding: 12px 6px;
  border: 2px solid var(--soft);
  background: #fff;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  color: #0d47a1;
}
.region-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.progress {
  font-size: 1rem;
  color: #555;
  margin-bottom: 12px;
  font-weight: bold;
}
.card {
  background: linear-gradient(180deg, #fffef8 0%, #e3f2fd 100%);
  border: 3px solid var(--soft);
  border-radius: 18px;
  padding: 20px 16px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.flag-wrap {
  width: 100%;
  max-width: 280px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 12px;
  border: 1px solid #eee;
  margin-bottom: 12px;
}
.flag-wrap img {
  max-width: 92%;
  max-height: 130px;
  object-fit: contain;
}
#answer-box {
  width: 100%;
  max-width: 280px;
  min-height: 4.2em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
#country-name {
  font-size: 1.45rem;
  font-weight: bold;
  line-height: 1.3;
  margin: 0;
  min-height: 1.4em;
}
#country-reading {
  font-size: 1rem;
  color: #666;
  margin: 4px 0 0;
  letter-spacing: 0.05em;
  min-height: 1.3em;
}
#country-name.is-placeholder,
#country-reading.is-placeholder {
  color: transparent;
  user-select: none;
}
.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.btn {
  padding: 18px 20px;
  border: none;
  border-radius: 28px;
  font-size: 1.25rem;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-main {
  background: #64b5f6;
  color: #0d47a1;
  box-shadow: 0 3px 0 #1976d2;
}
.btn-main.is-next {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 3px 0 #0d47a1;
}
.btn-main:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}
.btn-restart {
  background: #90a4ae;
  color: #fff;
  box-shadow: 0 3px 0 #607d8b;
  font-size: 1rem;
  padding: 12px 16px;
}
.done-msg {
  display: none;
  margin-top: 8px;
  padding: 14px;
  background: #e8f5e9;
  border-radius: 12px;
  color: #2e7d32;
  font-weight: bold;
  font-size: 1.1rem;
}
.done-msg.show { display: block; }
.hint {
  margin-top: 16px;
  font-size: 0.85rem;
  color: #888;
  line-height: 1.55;
}
.seo-box {
  width: 100%;
  max-width: 420px;
  margin: 28px auto 20px;
  padding: 18px 16px;
  background: rgba(255,255,255,0.92);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  text-align: left;
  color: #333;
  font-size: 0.88rem;
  line-height: 1.65;
}
.seo-box h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--primary);
}
.seo-box p { margin: 0 0 10px; }
.seo-box p:last-child { margin-bottom: 0; }
.region-order {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
}
.region-order-btn {
  flex: 1;
  padding: 8px;
  border: 2px solid var(--soft);
  background: #fff;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  color: #0d47a1;
}
.region-order-btn.active {
  background: var(--soft);
  color: #0d47a1;
}
