/* =========================================
   未開の星のミトラ - キーワード認証サイト
   色味：ダークティール × ファンタジー
   ========================================= */

:root {
  --bg-deep:        #14302f;
  --bg-panel:       #1d3f3e;
  --bg-panel-dark:  #16302f;
  --bg-input:       #0e2423;
  --border-gold:    #c9b27a;
  --border-gold-2:  #8a7a4c;
  --text-main:      #f3ecd6;
  --text-sub:       #c9c1a8;
  --accent-warn:    #e0744b;
  --shadow-deep:    rgba(0, 0, 0, 0.5);
  --shadow-glow:    rgba(201, 178, 122, 0.18);

  /* A/B/C のヒントカラー（赤/青/黄） */
  --col-a:          #d75a4a;
  --col-b:          #4a8ec0;
  --col-c:          #e0b54a;

  /* safe-area */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

html, body {
  min-height: 100%;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "游明朝", "MS P明朝", serif;
  color: var(--text-main);
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(circle at 18% 18%, rgba(201, 178, 122, 0.10) 0, transparent 48%),
    radial-gradient(circle at 82% 72%, rgba(74, 142, 192, 0.07) 0, transparent 55%),
    linear-gradient(180deg, #18342f 0%, #0c1f1e 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ふんわり浮かぶ星 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 15%,  #f3ecd6 50%, transparent 51%),
    radial-gradient(1px 1px at 35% 78%,  #f3ecd6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 70% 24%, #f3ecd6 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 60%,  #f3ecd6 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 48%,  #f3ecd6 50%, transparent 51%),
    radial-gradient(1px 1px at 25% 62%,  #f3ecd6 50%, transparent 51%),
    radial-gradient(1px 1px at 65% 88%,  #f3ecd6 50%, transparent 51%),
    radial-gradient(1px 1px at 5%  50%,  #f3ecd6 50%, transparent 51%);
  opacity: 0.4;
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle {
  from { opacity: 0.22; }
  to   { opacity: 0.55; }
}

/* =========================================
   レイアウト
   ========================================= */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3vw, 32px);
  padding:
    calc(clamp(28px, 5vw, 56px) + var(--safe-top))
    calc(clamp(16px, 4vw, 32px) + var(--safe-right))
    calc(clamp(32px, 5vw, 56px) + var(--safe-bottom))
    calc(clamp(16px, 4vw, 32px) + var(--safe-left));
}

/* =========================================
   カード（共通枠：飾り罫）
   ========================================= */
.card {
  position: relative;
  width: 100%;
  max-width: 520px;
  padding: clamp(28px, 5vw, 44px) clamp(20px, 4.5vw, 36px);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0.04) 100%),
    var(--bg-panel);
  border: 1px solid var(--border-gold-2);
  border-radius: 4px;
  box-shadow:
    0 18px 40px var(--shadow-deep),
    0 0 0 1px rgba(0,0,0,0.25),
    inset 0 0 0 1px var(--shadow-glow);
}

/* 角の飾り（左上＆右下） */
.card::before,
.card::after {
  content: "";
  position: absolute;
  width: clamp(18px, 4vw, 26px);
  height: clamp(18px, 4vw, 26px);
  border: 1px solid var(--border-gold);
  pointer-events: none;
}
.card::before { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.card::after  { bottom: 10px; right: 10px; border-left: none; border-top: none; }

/* 角の飾り（右上＆左下） */
.card .corner-tr,
.card .corner-bl {
  position: absolute;
  width: clamp(18px, 4vw, 26px);
  height: clamp(18px, 4vw, 26px);
  border: 1px solid var(--border-gold);
  pointer-events: none;
}
.card .corner-tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.card .corner-bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }

/* =========================================
   タイトル
   ========================================= */
.title {
  text-align: center;
  font-size: clamp(16px, 4.4vw, 22px);
  letter-spacing: 0.14em;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.5;
}

.hint-card-title {
  text-align: center;
  font-size: clamp(14px, 3.6vw, 16px);
  letter-spacing: 0.3em;
  color: var(--text-main);
  font-weight: 500;
  margin-bottom: clamp(10px, 2.4vw, 14px);
}

/* セパレーター：◆ をセンターに */
.divider {
  display: block;
  width: 100%;
  margin: clamp(14px, 3vw, 20px) auto;
  height: 1px;
  position: relative;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(201, 178, 122, 0.5) 50%,
    transparent 100%
  );
}
.divider::after {
  content: "◆";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8px;
  color: var(--border-gold);
  background: var(--bg-panel);
  padding: 0 8px;
  letter-spacing: 0.5em;
}

/* =========================================
   ヒント（タブ式）
   ========================================= */
.hint-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(6px, 1.5vw, 10px);
  margin-bottom: clamp(12px, 2.6vw, 16px);
}

.hint-tab {
  --c: var(--border-gold);
  position: relative;
  padding: 10px 6px;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  border-radius: 2px;
  color: var(--c);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}
.hint-tab[data-key="A"]       { --c: var(--col-a); }
.hint-tab[data-key="B"]       { --c: var(--col-b); }
.hint-tab[data-key="C"]       { --c: var(--col-c); }
.hint-tab[data-key="keyword"] { --c: var(--border-gold); }

.hint-tab:hover {
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border-color: var(--c);
}
.hint-tab:active { transform: translateY(1px); }
.hint-tab.active {
  background: var(--c);
  border-color: var(--c);
  color: var(--bg-panel-dark);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--c) 35%, transparent);
}

.hint-tab-label {
  font-size: clamp(12px, 3.2vw, 14px);
  letter-spacing: 0.1em;
  font-weight: 700;
}

/* パネル */
.hint-panel {
  --c: var(--border-gold);
  padding: clamp(14px, 3vw, 20px);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2vw, 14px);
  min-height: 130px;
  transition: border-color 0.3s;
}
.hint-panel[data-active="A"]       { --c: var(--col-a); }
.hint-panel[data-active="B"]       { --c: var(--col-b); }
.hint-panel[data-active="C"]       { --c: var(--col-c); }
.hint-panel[data-active="keyword"] { --c: var(--border-gold); }

.hint-panel-label {
  font-size: clamp(11px, 3vw, 13px);
  letter-spacing: 0.2em;
  color: var(--c);
  text-align: center;
  padding-bottom: clamp(6px, 1.5vw, 10px);
  border-bottom: 1px dashed color-mix(in srgb, var(--c) 35%, transparent);
}

.hint-empty {
  text-align: center;
  color: var(--text-sub);
  font-size: clamp(11px, 3vw, 13px);
  letter-spacing: 0.1em;
  opacity: 0.6;
  padding: clamp(10px, 2.5vw, 16px) 0;
}

.hint-done {
  text-align: center;
  color: var(--c, var(--border-gold));
  font-size: clamp(10px, 2.8vw, 12px);
  letter-spacing: 0.2em;
  padding-top: 2px;
  opacity: 0.9;
}

.hint-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.5vw, 10px);
}
.hint-steps:empty { display: none; }

.hint-step {
  display: flex;
  align-items: flex-start;
  gap: clamp(8px, 2vw, 12px);
  padding: clamp(8px, 1.8vw, 12px) clamp(10px, 2vw, 14px);
  background: rgba(0, 0, 0, 0.22);
  border-left: 2px solid var(--c, var(--border-gold));
  font-size: clamp(12px, 3.4vw, 14px);
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--text-main);
  word-break: break-word;
  animation: stepIn 0.35s ease both;
}
@keyframes stepIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

.hint-step-num {
  flex: 0 0 auto;
  font-size: clamp(10px, 2.6vw, 11px);
  letter-spacing: 0.18em;
  color: var(--c, var(--border-gold));
  padding-top: 3px;
  white-space: nowrap;
  opacity: 0.9;
}
.hint-step-text { flex: 1 1 auto; }

/* 答え（最終ステップ）の強調 */
.hint-step.is-answer {
  background: color-mix(in srgb, var(--c, var(--border-gold)) 14%, transparent);
  border-left-width: 3px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--border-gold)) 25%, transparent);
}
.hint-step.is-answer .hint-step-num {
  font-weight: 700;
  letter-spacing: 0.2em;
  opacity: 1;
}
/* 答えボタンは色塗りつぶし＆濃い文字色（specificity高めで上書き） */
.hint-panel[data-active] .hint-btn.is-answer-btn,
.hint-panel[data-active="A"] .hint-btn.is-answer-btn,
.hint-panel[data-active="B"] .hint-btn.is-answer-btn,
.hint-panel[data-active="C"] .hint-btn.is-answer-btn,
.hint-panel[data-active="keyword"] .hint-btn.is-answer-btn {
  background: var(--c, var(--border-gold));
  color: var(--bg-panel-dark);
  font-weight: 700;
  letter-spacing: 0.25em;
}
.hint-panel[data-active] .hint-btn.is-answer-btn:hover {
  background: var(--c, var(--border-gold));
  color: var(--bg-panel-dark);
  filter: brightness(1.08);
}

/* ヒント用ボタン（色連動） */
.hint-btn {
  --c: inherit;
  align-self: center;
  min-width: 220px;
  font-size: clamp(12px, 3.2vw, 13px);
  letter-spacing: 0.18em;
  padding: 11px 22px;
  background: transparent;
  color: var(--c, var(--border-gold));
  border: 1px solid var(--c, var(--border-gold));
  transition: background 0.2s, color 0.2s, transform 0.1s;
}
.hint-btn:hover {
  background: var(--c, var(--border-gold));
  color: var(--bg-panel-dark);
}
.hint-panel[data-active="A"] .hint-btn       { color: var(--col-a); border-color: var(--col-a); }
.hint-panel[data-active="A"] .hint-btn:hover { background: var(--col-a); color: var(--bg-panel-dark); }
.hint-panel[data-active="B"] .hint-btn       { color: var(--col-b); border-color: var(--col-b); }
.hint-panel[data-active="B"] .hint-btn:hover { background: var(--col-b); color: var(--bg-panel-dark); }
.hint-panel[data-active="C"] .hint-btn       { color: var(--col-c); border-color: var(--col-c); }
.hint-panel[data-active="C"] .hint-btn:hover { background: var(--col-c); color: var(--bg-panel-dark); }

/* =========================================
   入力欄＆ボタン
   ========================================= */
.input-row {
  display: flex;
  gap: clamp(8px, 2vw, 12px);
  flex-wrap: wrap;
}

.keyword-input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-gold-2);
  border-radius: 2px;
  color: var(--text-main);
  font-size: 16px;
  letter-spacing: 0.25em;
  text-align: center;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 48px;
}
.keyword-input::placeholder {
  color: rgba(243, 236, 214, 0.3);
  letter-spacing: 0.2em;
}
.keyword-input:focus {
  border-color: var(--border-gold);
  box-shadow: 0 0 0 1px var(--border-gold), 0 0 16px rgba(201, 178, 122, 0.25);
}

.btn {
  padding: 12px 26px;
  background: transparent;
  border: 1px solid var(--border-gold);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.2em;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s, transform 0.1s;
  min-height: 48px;
  min-width: 96px;
}
.btn:hover {
  background: var(--border-gold);
  color: var(--bg-panel-dark);
}
.btn:active { transform: translateY(1px); }

/* =========================================
   エラーメッセージ
   ========================================= */
.error {
  margin-top: clamp(12px, 2.5vw, 16px);
  text-align: center;
  color: var(--accent-warn);
  font-size: clamp(12px, 3vw, 13px);
  letter-spacing: 0.12em;
  min-height: 1.2em;
  opacity: 0;
  transition: opacity 0.3s;
}
.error.show { opacity: 1; }

/* =========================================
   web②：動画ページ
   ========================================= */
.video-page .card { max-width: 800px; }

.confirm-message {
  text-align: center;
  margin-bottom: clamp(14px, 3vw, 20px);
}
.confirm-message .line1 {
  font-size: clamp(14px, 3.8vw, 17px);
  letter-spacing: 0.14em;
  margin-bottom: 6px;
}
.confirm-message .line2 {
  font-size: clamp(11px, 3vw, 14px);
  letter-spacing: 0.12em;
  color: var(--text-sub);
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border-gold-2);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.4),
    0 12px 28px rgba(0,0,0,0.5);
  overflow: hidden;
}
@supports not (aspect-ratio: 16 / 9) {
  .video-wrap { aspect-ratio: auto; padding-top: 56.25%; }
}
.video-wrap > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* =========================================
   web③：最終ページ（画像1枚）
   ========================================= */
.final-page {
  padding: 0;
  background: #000;
  min-height: 100vh;
  min-height: 100dvh;
}
.final-page img {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  object-fit: contain;
}

.final-placeholder {
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-main);
  background:
    radial-gradient(ellipse at top, rgba(74,142,192,0.18) 0%, transparent 60%),
    radial-gradient(ellipse at bottom, rgba(215,90,74,0.12) 0%, transparent 65%),
    linear-gradient(180deg, #0a1a30 0%, #000 100%);
  padding: clamp(24px, 6vw, 64px);
}
.final-placeholder.show { display: flex; }
.final-placeholder .lead {
  font-size: clamp(11px, 3vw, 14px);
  letter-spacing: 0.4em;
  opacity: 0.85;
}
.final-placeholder .product {
  margin: clamp(20px, 4.5vw, 32px) 0;
  font-size: clamp(24px, 7vw, 44px);
  letter-spacing: 0.18em;
  line-height: 1.4;
}
.final-placeholder .release {
  font-size: clamp(11px, 3vw, 13px);
  letter-spacing: 0.25em;
  opacity: 0.7;
}
.final-placeholder .hint {
  margin-top: clamp(24px, 5vw, 40px);
  font-size: clamp(9px, 2.4vw, 10px);
  opacity: 0.35;
}

/* =========================================
   フェード演出
   ========================================= */
.fade-in { animation: fadeIn 0.6s ease both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================
   メディアクエリ（細かい調整）
   ========================================= */

/* 超小型スマホ（〜374px） */
@media (max-width: 374px) {
  .input-row { flex-direction: column; }
  .btn       { width: 100%; }
  .hint-btn  { min-width: 0; width: 100%; }
  .hint-step { letter-spacing: 0.02em; }
  .hint-tab  { padding: 8px 2px; }
  .hint-tab-label { letter-spacing: 0.05em; }
}

/* スマホ縦（〜600px） */
@media (max-width: 600px) {
  .hint-btn { min-width: 0; width: 100%; }
  .card { padding: clamp(24px, 6vw, 32px) clamp(16px, 5vw, 22px); }
}

/* タブレット（601px〜1023px） */
@media (min-width: 601px) and (max-width: 1023px) {
  .card { max-width: 600px; }
}

/* デスクトップでもスマホと同じ縦並びをキープ。最大幅だけ調整 */
@media (min-width: 1024px) {
  .video-page .card { max-width: 900px; }
}
@media (min-width: 1400px) {
  .video-page .card { max-width: 1000px; }
}

/* 横向きスマホ：縦並び維持。余白だけ詰める */
@media (max-height: 480px) and (orientation: landscape) {
  .page {
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 14px;
    justify-content: flex-start;
  }
  .card { padding: clamp(18px, 3vw, 22px) clamp(20px, 3.5vw, 28px); }
  .title { font-size: 15px; }
  .divider { margin: 10px auto; }
  .hint-card-title { margin-bottom: 8px; font-size: 13px; }
  .hint-tabs { margin-bottom: 10px; }
  .hint-panel { min-height: auto; padding: 10px 14px; gap: 8px; }
  .hint-step { padding: 6px 10px; font-size: 12px; }
  .keyword-input { min-height: 42px; padding: 10px 14px; }
  .btn { min-height: 42px; padding: 10px 20px; }
  .hint-btn { padding: 8px 16px; }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  body::before,
  .fade-in,
  .hint-step {
    animation: none;
  }
  * { transition: none !important; }
}
