:root {
  --trial-bg: #fffaf0;
  --trial-panel: rgba(255, 255, 255, 0.92);
  --trial-ink: #3f2a16;
  --trial-muted: #78613c;
  --trial-line: rgba(63, 42, 22, 0.18);
  --trial-yellow: #ffdb45;
  --trial-orange: #ff8442;
  --trial-teal: #009b8d;
  --trial-cyan: #2ce4f2;
  --trial-dark: #02070a;
  --trial-red: #ff4b55;
  --trial-green: #55e680;
  --trial-shadow: 0 22px 70px rgba(63, 42, 22, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 219, 69, 0.42), transparent 30%),
    linear-gradient(rgba(63, 42, 22, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 42, 22, 0.04) 1px, transparent 1px),
    var(--trial-bg);
  background-size: auto, 40px 40px, 40px 40px, auto;
  color: var(--trial-ink);
  font-family: "Noto Sans JP", "Noto Sans", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  letter-spacing: 0;
}

body.trial-roguelike {
  --trial-bg: #02070a;
  --trial-panel: rgba(3, 13, 17, 0.9);
  --trial-ink: #f7fbff;
  --trial-muted: #9aa7b7;
  --trial-line: rgba(44, 228, 242, 0.34);
  --trial-yellow: #ffb72b;
  --trial-orange: #ffb72b;
  background:
    radial-gradient(circle at 50% 0%, rgba(44, 228, 242, 0.18), transparent 34%),
    linear-gradient(rgba(44, 228, 242, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(44, 228, 242, 0.06) 1px, transparent 1px),
    var(--trial-bg);
  background-size: auto, 44px 44px, 44px 44px, auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.trial-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.trial-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.trial-back,
.trial-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 2px solid var(--trial-line);
  border-radius: 999px;
  background: var(--trial-panel);
  color: var(--trial-ink);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.trial-roguelike .trial-back,
.trial-roguelike .trial-pill {
  border-radius: 8px;
  color: var(--trial-cyan);
  box-shadow: 0 0 28px rgba(44, 228, 242, 0.12);
}

.trial-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
  gap: 22px;
  align-items: stretch;
}

.trial-panel {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--trial-line);
  border-radius: 22px;
  background: var(--trial-panel);
  box-shadow: var(--trial-shadow);
}

.trial-roguelike .trial-panel {
  border-radius: 8px;
  box-shadow: 0 0 44px rgba(44, 228, 242, 0.08);
}

.trial-copy {
  padding: clamp(22px, 4vw, 42px);
}

.trial-copy h1 {
  margin: 18px 0 0;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 1.05;
  font-weight: 1000;
}

.trial-copy p {
  margin: 18px 0 0;
  color: var(--trial-muted);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.8;
  font-weight: 800;
}

.trial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.trial-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 2px solid var(--trial-line);
  border-radius: 12px;
  background: var(--trial-teal);
  color: #fff;
  cursor: pointer;
  font-weight: 1000;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.trial-button:hover,
.trial-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 155, 141, 0.22);
  outline: 0;
}

.trial-button:active {
  transform: translateY(1px);
}

.trial-button--ghost {
  background: transparent;
  color: var(--trial-ink);
}

.trial-roguelike .trial-button {
  border-radius: 8px;
  background: var(--trial-cyan);
  color: #001014;
  box-shadow: 0 0 24px rgba(44, 228, 242, 0.12);
}

.trial-roguelike .trial-button--ghost {
  background: rgba(3, 15, 20, 0.86);
  color: var(--trial-cyan);
}

.trial-stage {
  display: grid;
  gap: 14px;
  min-height: 620px;
  padding: clamp(14px, 2vw, 20px);
}

.trial-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.trial-stat {
  min-height: 70px;
  padding: 12px;
  border: 2px solid var(--trial-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.trial-roguelike .trial-stat {
  border-radius: 8px;
  background: rgba(1, 8, 11, 0.74);
}

.trial-stat span {
  display: block;
  color: var(--trial-muted);
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}

.trial-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  line-height: 1;
}

.trial-app {
  min-height: 372px;
  display: grid;
  align-items: stretch;
  border: 2px solid var(--trial-line);
  border-radius: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.52)),
    var(--trial-bg);
  overflow: hidden;
}

.trial-roguelike .trial-app {
  border-radius: 8px;
  background:
    linear-gradient(rgba(44, 228, 242, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(44, 228, 242, 0.07) 1px, transparent 1px),
    rgba(2, 7, 10, 0.95);
  background-size: 38px 38px;
}

.learning-game {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 28px;
}

.learning-game::before {
  content: attr(data-learning-status);
  position: absolute;
  top: 18px;
  left: 18px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 2px solid rgba(255, 132, 66, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--trial-orange);
  font-size: 13px;
  font-weight: 1000;
}

.banana-avatar {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 30px;
  background: linear-gradient(135deg, #fff597, #ffdb45);
  box-shadow: 0 14px 30px rgba(255, 132, 66, 0.18);
  font-size: 52px;
  animation: trialFloat 2.6s ease-in-out infinite;
}

.prompt {
  margin: 0;
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1.12;
  text-align: center;
  font-weight: 1000;
}

.choice-grid {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice {
  min-height: 84px;
  border: 0;
  border-radius: 18px;
  background: #ff8442;
  color: #fff;
  cursor: pointer;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 1000;
  box-shadow: inset 0 -6px rgba(63, 42, 22, 0.14), 0 10px 22px rgba(63, 42, 22, 0.12);
}

.choice:nth-child(2) {
  background: #4ebbe8;
}

.choice:nth-child(3) {
  background: #7cc879;
}

.choice:nth-child(4) {
  background: #ce88d6;
}

.choice.is-correct {
  animation: correctPop 420ms ease;
  filter: brightness(1.12);
}

.choice.is-wrong {
  animation: wrongShake 300ms ease;
  filter: grayscale(0.2) brightness(0.86);
}

.feedback {
  min-height: 28px;
  color: var(--trial-teal);
  font-size: 18px;
  font-weight: 1000;
}

.rogue-game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 188px;
  gap: 12px;
  padding: 14px;
}

.rogue-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 2px;
  min-height: 346px;
}

.tile {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 42px;
  background: rgba(17, 53, 65, 0.82);
  border: 1px solid rgba(44, 228, 242, 0.12);
  color: var(--trial-ink);
  font-size: 24px;
  overflow: hidden;
}

.tile--wall {
  background: rgba(0, 4, 6, 0.94);
}

.tile--stairs {
  color: var(--trial-yellow);
}

.tile--trap {
  color: #ff4b55;
}

.tile-sprite {
  width: 82%;
  height: 82%;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(44, 228, 242, 0.48));
}

.tile--player,
.tile--enemy,
.tile--item,
.tile--stairs,
.tile--trap {
  filter: drop-shadow(0 0 10px currentColor);
}

.tile--fx-hit::before,
.tile--fx-arrow::before,
.tile--fx-skill::before,
.tile--fx-trap::before,
.tile--fx-item::before {
  content: "";
  position: absolute;
  inset: 8%;
  z-index: 0;
  border-radius: 999px;
  pointer-events: none;
  animation: fxPulse 420ms ease-out;
}

.tile--fx-hit::before {
  background: rgba(255, 75, 85, 0.35);
  box-shadow: 0 0 28px rgba(255, 75, 85, 0.68);
}

.tile--fx-arrow::before {
  background: linear-gradient(90deg, transparent, rgba(255, 183, 43, 0.78), transparent);
  transform: rotate(-18deg);
}

.tile--fx-skill::before,
.tile--fx-item::before {
  background: rgba(85, 230, 128, 0.32);
  box-shadow: 0 0 30px rgba(85, 230, 128, 0.72);
}

.tile--fx-trap::before {
  background: rgba(255, 75, 85, 0.28);
  box-shadow: 0 0 30px rgba(255, 75, 85, 0.7);
}

.rogue-side {
  display: grid;
  align-content: start;
  gap: 10px;
}

.rogue-log {
  min-height: 136px;
  padding: 10px;
  border: 1px solid var(--trial-line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--trial-cyan);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

.rogue-modebar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.rogue-modebar button,
.rogue-actionbar button,
.rogue-controls button {
  min-height: 40px;
  border: 1px solid var(--trial-line);
  border-radius: 8px;
  background: rgba(3, 15, 20, 0.9);
  color: var(--trial-cyan);
  cursor: pointer;
  font-size: 12px;
  font-weight: 1000;
}

.rogue-modebar button.is-active {
  background: var(--trial-cyan);
  color: #001014;
  box-shadow: 0 0 18px rgba(44, 228, 242, 0.28);
}

.rogue-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.rogue-actionbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}


.trial-progress {
  display: grid;
  gap: 8px;
}

.trial-progress__bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(63, 42, 22, 0.14);
}

.trial-roguelike .trial-progress__bar {
  background: rgba(44, 228, 242, 0.12);
}

.trial-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--trial-teal), var(--trial-yellow));
  transition: width 220ms ease;
}

.trial-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--trial-muted);
  font-size: 13px;
  font-weight: 900;
}

.trial-finish {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(12px);
}

.trial-finish.is-open {
  display: grid;
}

.trial-finish__panel {
  width: min(520px, 100%);
  padding: clamp(22px, 5vw, 38px);
  border: 2px solid var(--trial-line);
  border-radius: 20px;
  background: var(--trial-panel);
  color: var(--trial-ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  text-align: center;
}

.trial-roguelike .trial-finish__panel {
  border-radius: 8px;
  box-shadow: 0 0 56px rgba(44, 228, 242, 0.18);
}

.trial-finish__panel h2 {
  margin: 10px 0 0;
  font-size: clamp(30px, 6vw, 48px);
  line-height: 1.1;
}

.trial-finish__panel p {
  color: var(--trial-muted);
  font-weight: 800;
  line-height: 1.75;
}

.store-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

@keyframes trialFloat {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

@keyframes correctPop {
  50% {
    transform: scale(1.06);
  }
}

@keyframes wrongShake {
  20%, 60% {
    transform: translateX(-5px);
  }
  40%, 80% {
    transform: translateX(5px);
  }
}

@keyframes fxPulse {
  0% {
    opacity: 0;
    transform: scale(0.42);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

@media (max-width: 860px) {
  .trial-hero {
    grid-template-columns: 1fr;
  }

  .trial-stage {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .trial-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 12px;
  }

  .trial-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .trial-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trial-copy,
  .trial-stage {
    padding: 16px;
  }

  .choice-grid,
  .store-links {
    grid-template-columns: 1fr;
  }

  .rogue-game {
    grid-template-columns: 1fr;
  }

  .rogue-board {
    min-height: 310px;
  }

  .rogue-modebar,
  .rogue-actionbar {
    grid-template-columns: repeat(2, 1fr);
  }

  .rogue-controls {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
