/*
  ぜんぶの ゲームで つかう みため
  ------------------------------------------------------------
  いろや もじの おおきさは :root に まとめて あるので、
  ここを かえると サイト ぜんたいの いろが かわる。
*/

/* ===== いろ・もじ・かどの まるさ ===== */
:root {
  --color-bg: #1c1e52;          /* はいけい */
  --color-bg-deep: #121338;     /* はいけい（こい ところ） */
  --color-panel: #ffffff;       /* しろい わく */
  --color-text: #2a2856;        /* しろい わくの なかの もじ */
  --color-text-sub: #6e6c95;    /* うすい もじ */
  --color-text-light: #ffffff;  /* こい はいけいの うえの もじ */
  --color-main: #ff7a3d;        /* いちばん めだつ いろ（オレンジ） */
  --color-main-dark: #d4561d;
  --color-accent: #2fbcf5;      /* 2ばんめの いろ（みずいろ） */
  --color-accent-dark: #1789bf;
  --color-yellow: #ffd23f;
  --color-pink: #ff5d8f;
  --color-green: #3fd18b;
  --color-line: #e3e1f3;        /* うすい せん */

  --radius-large: 24px;
  --radius-medium: 16px;
  --radius-small: 10px;
  --shadow: 0 12px 32px rgba(5, 6, 30, 0.35);

  /* パソコンや スマホに はいっている まるい もじを つかう（そとから よみこまない） */
  --font: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDPGothic",
    "Hiragino Sans", "Meiryo", system-ui, sans-serif;
}

/* ===== きほん ===== */
* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.6;
  color: var(--color-text-light);
  background-color: var(--color-bg);
  /* ぼんやり ひかる まるを かさねて、ゲームらしい はいけいに する */
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 93, 143, 0.28), transparent 38%),
    radial-gradient(circle at 88% 18%, rgba(47, 188, 245, 0.25), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(255, 210, 63, 0.16), transparent 45%),
    linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-deep) 100%);
}

a {
  color: inherit;
}

/* hidden が ついた ものは かならず かくす */
[hidden] {
  display: none !important;
}

/* ふりがな */
ruby rt {
  font-size: 0.5em;
  font-weight: 700;
}

/* ページの はば */
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
}

/* しろい わく */
.panel {
  background: var(--color-panel);
  color: var(--color-text);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

/* ===== ボタン ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 10px 22px;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}

.btn:hover {
  filter: brightness(1.06);
}

/* おしたときに ボタンが しずむ */
.btn:active {
  transform: translateY(4px);
}

.btn:focus-visible {
  outline: 3px solid var(--color-yellow);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  filter: none;
}

.btn--main {
  color: #fff;
  background: var(--color-main);
  box-shadow: 0 5px 0 var(--color-main-dark);
}

.btn--main:active {
  box-shadow: 0 1px 0 var(--color-main-dark);
}

.btn--accent {
  color: #fff;
  background: var(--color-accent);
  box-shadow: 0 5px 0 var(--color-accent-dark);
}

.btn--accent:active {
  box-shadow: 0 1px 0 var(--color-accent-dark);
}

.btn--ghost {
  color: var(--color-text-light);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
}

.btn--ghost:active {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.btn--big {
  min-height: 60px;
  padding: 12px 40px;
  font-size: 1.35rem;
}

/* ===== ゲームの ページ ===== */
/*
  ゲームの ページは、みえて いる がめんの たかさ（100dvh）を きじゅんに する。
  ばんめんなど「のこりの たかさに あわせる もの」は、ゲームごとの style.css で
  flex: 1 1 0（のこりを ぜんぶ もらう）に して おおきさを きめる。
*/
.page--game {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.page--game > main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

/* がめん（せってい・あそぶ）は よこはば いっぱいに する（max-width は ゲームごとに きめる） */
.page--game > main > section {
  width: 100%;
}

/* あたま（「ゲーム いちらん」へ もどる リンク と ゲームの なまえ） */
.game-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0 16px;
}

.back-link {
  align-self: flex-start;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.back-link:hover {
  color: #fff;
}

.game-title {
  margin: 0;
  font-size: clamp(1.7rem, 6vw, 2.4rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

/*
  スマホでは、スクロール しないで 1がめんに おさまるように つめる。
  ただし がめんの たかさに よゆうが ある ときは、すきまや ボタンを なめらかに ひろげる。

  --spare は「たかさの よゆう」（たかさ 640px いかで 0px、830px いじょうで 190px）。
  calc() で つかう（れい: calc(6px + var(--spare) * 10 / 190) は 6px〜16px に なる）。
*/
@media (max-width: 600px) {
  .page--game {
    --spare: clamp(0px, 100dvh - 640px, 190px);
    padding: calc(4px + var(--spare) * 6 / 190) 16px calc(10px + var(--spare) * 10 / 190);
  }

  /* もどる リンク と なまえを 1ぎょうに ならべる */
  .game-header {
    flex-direction: row;
    gap: 8px;
    padding: 0 0 calc(6px + var(--spare) * 10 / 190);
  }

  .back-link {
    flex: none;
    align-self: center;
    padding: 10px 0; /* ゆびで おしやすい たかさに する */
    font-size: calc(0.8rem + var(--spare) * 1.6 / 190);
  }

  .game-title {
    flex: 1;
    min-width: 0;
    font-size: calc(1.35rem + var(--spare) * 6 / 190);
    line-height: 1.3;
    letter-spacing: 0.02em;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  }

  /* せっていの がめん */
  .page--game .setup {
    gap: calc(12px + var(--spare) * 10 / 190);
    padding: calc(14px + var(--spare) * 8 / 190) 14px calc(16px + var(--spare) * 8 / 190);
  }

  .page--game .setting-title {
    margin-bottom: calc(6px + var(--spare) * 4 / 190);
    font-size: calc(1rem + var(--spare) * 1.6 / 190);
  }

  .page--game .setting-note {
    margin-top: calc(4px + var(--spare) * 2 / 190);
    font-size: calc(0.78rem + var(--spare) * 1.6 / 190);
    line-height: 1.45;
  }

  .page--game .setup-best {
    padding: calc(4px + var(--spare) * 3 / 190) 14px;
    font-size: calc(0.85rem + var(--spare) * 1.6 / 190);
  }

  .page--game .setup .btn--big {
    min-height: calc(52px + var(--spare) * 8 / 190);
    font-size: calc(1.2rem + var(--spare) * 3 / 190);
  }

  /* あそぶ がめんの ボタン（さいしょから・せっていに もどる など） */
  .page--game .play-buttons .btn {
    min-height: calc(44px + var(--spare) * 8 / 190);
  }
}

/*
  がめんが ひくい ときだけ みじかく する もの（ながい ほうと みじかい ほうを りょうほう かいて おく）
  .text-long … よゆうが ある とき（と パソコン）に だす
  .text-short … ひくい スマホで だす
*/
.text-short {
  display: none;
}

@media (max-width: 600px) and (max-height: 700px) {
  .text-long {
    display: none;
  }

  .text-short {
    display: inline;
  }
}

/* けっかの がめん（クリア・おしまい）も、たかさが みじかい ときは つめて はみださないように する */
@media (max-height: 700px) {
  .clear-dialog .clear-box,
  .end-dialog .end-box,
  .page--game .clear-box {
    gap: 10px;
    padding: 16px 14px 14px;
  }

  .clear-dialog .clear-title,
  .end-dialog .end-title {
    font-size: 2rem;
  }

  .clear-buttons .btn,
  .end-buttons .btn {
    min-height: 44px;
    padding: 6px 16px;
    font-size: 0.95rem;
  }

  .clear-dialog .clear-buttons,
  .end-dialog .end-buttons,
  .page--game .clear-buttons {
    gap: 10px;
  }

  .clear-dialog .studio-button,
  .end-dialog .studio-button,
  .page--game .studio-button {
    margin-top: 0;
    padding: 8px 12px;
  }
}

/* ===== サイトの あたま・あし ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 4px;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.site-logo-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.site-footer {
  margin-top: 48px;
  padding: 24px 0 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

/* うごきを へらす せっていの ひとには、アニメーションを ひかえめに する */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
