/* スマホで答える画面。幅 360〜430px を主に、片手の親指で押せる大きさにする */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12px 16px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 0.02em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2.5px solid var(--line);
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--line);
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slide-up 0.35s ease both;
}

/* ---- トップ ---- */
.hero {
  position: relative;
  text-align: center;
  padding: 18px 16px 20px;
  overflow: hidden;
  background: linear-gradient(160deg, #ffffff 0%, #eaf2ff 100%);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(215, 40, 47, 0.12) 1.6px, transparent 1.8px);
  background-size: 12px 12px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
  pointer-events: none;
}

.hero-kicker {
  position: relative;
  display: inline-block;
  padding: 2px 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.hero-title {
  position: relative;
  margin: 10px 0 2px;
  font-size: 2.35rem;
  line-height: 1.15;
  font-weight: 800;
  color: var(--blue);
  -webkit-text-stroke: 1.5px var(--navy);
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--yellow);
  letter-spacing: 0.02em;
}

.hero-sub {
  position: relative;
  margin: 0;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.95rem;
}

.hero-azkun {
  position: relative;
  display: block;
  width: 190px;
  max-width: 60%;
  margin: 8px auto 0;
  animation: bob 3.2s ease-in-out infinite;
}

.countdown {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.countdown-cell {
  min-width: 62px;
  padding: 6px 4px 4px;
  border: 2.5px solid var(--line);
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  text-align: center;
  box-shadow: 2px 2px 0 var(--red);
}

.countdown-num {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.countdown-unit {
  display: block;
  font-size: 0.72rem;
  opacity: 0.85;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy);
}

.section-title .ic {
  color: var(--blue);
}

.big-rate {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 12px;
}

.big-rate-num {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}

.big-rate-note {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.9rem;
}

.dept-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dept-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
}

.dept-bar-head .me {
  color: var(--red);
}

.dept-bar-val {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar {
  height: 16px;
  margin-top: 4px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: repeating-linear-gradient(-45deg, var(--blue) 0 8px, #2a74cc 8px 16px);
  transition: width 1.1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bar-fill.is-me {
  background: repeating-linear-gradient(-45deg, var(--red) 0 8px, #e8454b 8px 16px);
}

.meta-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.cta-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}

/* ---- 登録 ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field + .field {
  margin-top: 16px;
}

.field-label {
  font-weight: 800;
  color: var(--navy);
}

.field-hint {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.input {
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border: 2.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 1.15rem;
  font-weight: 700;
}

.input:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(47, 181, 232, 0.45);
}

.input[aria-invalid='true'] {
  border-color: var(--ng);
  background: var(--ng-bg);
}

.field-error {
  color: var(--ng);
  font-weight: 800;
  font-size: 0.9rem;
}

.chips {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  border: 2.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: 800;
  text-align: left;
}

.chip-dot {
  width: 22px;
  height: 22px;
  flex: none;
  border: 2.5px solid var(--line);
  border-radius: 50%;
  background: #fff;
}

.chip[aria-checked='true'] {
  background: #e8f1ff;
  box-shadow: var(--shadow-sm);
}

.chip[aria-checked='true'] .chip-dot {
  background: var(--blue);
  box-shadow: inset 0 0 0 4px #fff;
}

/* ---- 問題 ---- */
.q-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress {
  flex: 1;
  height: 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--yellow);
  border-right: 2px solid var(--line);
  transition: width 0.4s ease;
}

.q-count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  white-space: nowrap;
}

.q-card {
  position: relative;
  padding-top: 26px;
}

.q-no {
  position: absolute;
  top: -16px;
  left: 16px;
  padding: 2px 14px;
  border: 2.5px solid var(--line);
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 2px 2px 0 var(--line);
}

.q-kari {
  position: absolute;
  top: -13px;
  right: 16px;
  background: #fff;
}

.q-text {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.6;
  font-weight: 800;
  color: var(--ink);
}

.q-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin-top: 12px;
  border-radius: var(--radius-sm);
  border: 2px solid #d5dbe7;
  background: #fff;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choices.is-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  border: 2.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  text-align: left;
  font-weight: 800;
  font-size: 1.08rem;
  line-height: 1.45;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s;
}

.choice:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.choice-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 2.5px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  font-weight: 800;
}

.choice[aria-pressed='true'] {
  background: var(--blue);
  color: #fff;
  animation: pop-in 0.3s ease;
}

.choice[aria-pressed='true'] .choice-mark {
  background: var(--yellow);
  color: var(--navy);
}

.choice-img {
  flex-direction: column;
  align-items: stretch;
  padding: 8px;
}

.choice-img img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
}

.choice-img .choice-mark {
  align-self: center;
}

.number-box {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.number-box .input {
  flex: 1;
  min-width: 0;
}

.number-box .btn {
  flex: none;
  white-space: nowrap;
}

.number-input {
  font-size: 1.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.q-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* ---- 確認 ---- */
.review-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  text-align: left;
}

.review-no {
  flex: none;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}

.review-body {
  flex: 1;
  min-width: 0;
}

.review-q {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-a {
  display: block;
  font-weight: 800;
}

.review-thumb {
  height: 36px;
  width: auto;
  vertical-align: middle;
  border-radius: 6px;
  border: 1px solid #d5dbe7;
}

.review-item .ic {
  color: var(--muted);
}

/* ---- 答え終わり・待ち ---- */
.center {
  text-align: center;
}

.done-title {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--blue);
  -webkit-text-stroke: 1px var(--navy);
  paint-order: stroke fill;
}

.done-azkun {
  display: block;
  width: 220px;
  max-width: 70%;
  margin: 0 auto;
  animation: pop-in 0.6s ease both;
}

.lead {
  margin: 0;
  font-weight: 700;
  color: var(--ink-soft);
}

.speech {
  position: relative;
  margin: 0;
  padding: 12px 14px;
  border: 2.5px solid var(--line);
  border-radius: 16px;
  background: #fff;
  font-weight: 800;
}

/* ---- 結果 ---- */
.result-hero {
  text-align: center;
  background: linear-gradient(160deg, #fff 0%, #fff6d9 100%);
}

.result-rank {
  margin: 4px 0 0;
  font-weight: 800;
  color: var(--navy);
}

.result-rank-num {
  display: inline-block;
  font-size: 4rem;
  line-height: 1;
  color: var(--red);
  -webkit-text-stroke: 2px var(--navy);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--yellow);
  font-variant-numeric: tabular-nums;
}

.result-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 2.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  position: sticky;
  top: 8px;
  z-index: 5;
}

.tab {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.tab[aria-selected='true'] {
  background: var(--navy);
  color: #fff;
}

.ans-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ans-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ans-q {
  margin: 0;
  font-weight: 800;
  font-size: 1.05rem;
}

.ans-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ans-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px solid #d5dbe7;
  border-radius: 10px;
  font-weight: 700;
}

.ans-choice.is-correct {
  border-color: var(--ok);
  background: var(--ok-bg);
  font-weight: 800;
}

.ans-choice.is-mine:not(.is-correct) {
  border-color: var(--ng);
  background: var(--ng-bg);
}

.ans-choice img {
  height: 48px;
  width: auto;
  border-radius: 6px;
}

.ans-choice-label {
  flex: 1;
  min-width: 0;
}

.ans-choice-rate {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-size: 0.85rem;
  white-space: nowrap;
}

.mine-tag {
  flex: none;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.ans-verdict {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
}

.ans-verdict.ok {
  color: var(--ok);
}

.ans-verdict.ng {
  color: var(--ng);
}

.explain {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff8e1;
  border: 2px solid #f1d27a;
  font-weight: 700;
}

.explain .ic {
  color: #b7860b;
  margin-top: 0.2em;
}

.src-dept {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.rank-search {
  position: relative;
}

.rank-search .ic-wrap {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.rank-search .input {
  padding-left: 42px;
  font-size: 1rem;
  min-height: 50px;
}

.rank-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 2.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.rank-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 12px;
  border-top: 1px solid #e3e8f1;
}

.rank-row:first-child {
  border-top: 0;
}

.rank-row.is-me {
  background: #fff1c7;
  font-weight: 800;
}

.rank-no {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  text-align: center;
}

.rank-no.top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--yellow);
}

.rank-name {
  min-width: 0;
}

.rank-name b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-name small {
  color: var(--muted);
  font-weight: 700;
}

.rank-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.more-row {
  padding: 10px;
  text-align: center;
}

.form-card .btn {
  margin-top: 12px;
}

.footer-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  font-weight: 700;
}

.loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-soft);
  font-weight: 700;
}

@media (min-width: 400px) {
  .chips {
    grid-template-columns: 1fr 1fr;
  }
}
