/* ARCANIMA — デザイントークン + 共通部品 + 画面 + ミニゲーム */

:root {
  --bg: #080c22;
  --bg2: #0f1638;
  --panel: rgba(20, 28, 68, 0.86);
  --panel-solid: #141c44;
  --line: #2c3c86;
  --line-hi: #4d67d8;
  --text: #eef2ff;
  --text-dim: #a8b3e0;
  --gold: #ffc233;
  --gold-deep: #e08a00;
  --cyan: #3fe0ff;
  --red: #ff4d6d;
  --green: #3ddc84;
  --violet: #9a5cff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --font: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic', sans-serif;
  --font-title: 'Dela Gothic One', 'M PLUS Rounded 1c', sans-serif;
  --fs: 17px;
}

#app[data-font='large'] {
  --fs: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* ------------------------------------------------------------ ボタン */

.btn {
  appearance: none;
  border: 2px solid var(--line-hi);
  background: linear-gradient(180deg, #243275, #18215a);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 0 #0a1034, var(--shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s;
  min-height: 48px;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0a1034;
}

.btn:disabled {
  filter: grayscale(0.8) brightness(0.6);
  cursor: default;
}

.btn.primary {
  background: linear-gradient(180deg, #ffd766, var(--gold) 45%, var(--gold-deep));
  border-color: #fff0b8;
  color: #3a2200;
  box-shadow: 0 4px 0 #8a5200, 0 0 18px rgba(255, 194, 51, 0.35);
}

.btn.cyan {
  background: linear-gradient(180deg, #7ff0ff, #16b6dd);
  border-color: #c9f8ff;
  color: #06283a;
  box-shadow: 0 4px 0 #06627a, 0 0 18px rgba(63, 224, 255, 0.3);
}

.btn.ghost {
  background: transparent;
  box-shadow: none;
  border-color: var(--line);
}

.btn:focus-visible,
.icon-btn:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}

.icon-btn {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 20px;
}

/* ------------------------------------------------------------ ミニゲーム */

.game-root {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, #1a2566, var(--bg) 70%);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 50;
}

.game-canvas {
  position: absolute;
  inset: 0;
  display: block;
}

.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  background: linear-gradient(180deg, rgba(8, 12, 34, 0.9), rgba(8, 12, 34, 0));
  pointer-events: none;
  z-index: 2;
}

.game-hud .game-exit {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--line-hi);
  background: var(--panel-solid);
  font-size: 20px;
  cursor: pointer;
}

.game-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-info {
  flex: 1;
  text-align: right;
  font-size: 14px;
  color: var(--text-dim);
}

.game-score {
  min-width: 64px;
  text-align: right;
  font-family: var(--font-title);
  font-size: 24px;
  color: var(--gold);
  text-shadow: 0 2px 0 #5a3300;
}

.game-end {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 6, 20, 0.66);
  z-index: 5;
  animation: fade-in 0.25s ease;
}

.game-end-card {
  width: min(340px, 88vw);
  background: var(--panel-solid);
  border: 2px solid var(--line-hi);
  border-radius: 20px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.game-end-card h2 {
  margin: 0 0 10px;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 28px;
  color: var(--gold);
}

.game-end-card p {
  margin: 6px 0;
}

.game-end-score {
  font-size: 22px;
  font-weight: 800;
}

.game-end-best {
  color: var(--cyan);
  font-weight: 800;
}

.game-end-reward {
  color: var(--cyan);
  font-weight: 800;
}

.game-end-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}
