@import url("../style.css");

:root {
  font-family: "MaruMinyaM", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
}

body {
  overflow: hidden;
  overscroll-behavior: none;
}

[hidden] {
  display: none !important;
}

button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid rgba(223, 248, 255, 0.5);
  border-radius: 6px;
  background: rgba(223, 248, 255, 0.94);
  color: #05222b;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 3px solid #81d9ed;
  outline-offset: 3px;
}

.app {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  display: grid;
  place-items: center;
}

.orientation-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  box-sizing: border-box;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(12px, 3vh, 24px);
  background: #071116;
  color: #fff7ad;
  text-align: center;
}
.orientation-gate p { margin: 0; font-size: clamp(24px, 5vw, 48px); line-height: 1.35; }
.orientation-gate p + p { color: #d7f8ff; font-size: clamp(18px, 3.5vw, 32px); }

.menu-screen {
  width: min(720px, 100%);
  max-height: 100%;
  overflow: hidden;
  padding: clamp(24px, 6vw, 64px);
  border: 1px solid rgba(223, 248, 255, 0.22);
  border-radius: 14px;
  background: rgba(2, 19, 24, 0.78);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.eyebrow,
.standalone-note {
  color: #9fd3db;
  letter-spacing: 0.14em;
  font-size: 12px;
}

.menu-screen h1,
.menu-screen h2 {
  margin: 12px 0;
  color: #fff7ad;
}

.menu-screen h1 { font-size: clamp(28px, 7vw, 52px); }
.menu-screen h2 { font-size: clamp(24px, 5vw, 38px); }
.lead { line-height: 1.7; }
.rules-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  box-sizing: border-box;
  width: auto;
  height: auto;
  min-height: 0;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vh, 16px);
  overflow: hidden;
}
.tutorial-host { flex: 1 1 auto; min-width: 0; min-height: 0; width: 100%; margin: 0; display: grid; place-items: center; }
.tutorial-page { position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid rgba(223, 248, 255, 0.2); background: rgba(0, 0, 0, 0.18); cursor: pointer; touch-action: manipulation; user-select: none; }
.tutorial-page img { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; object-position: center; opacity: 0; transition: opacity 100ms ease; image-rendering: auto; }
.tutorial-page.has-image img { opacity: 1; }
.tutorial-loading { margin: 0; position: absolute; color: #d7f8ff; font-size: clamp(18px, 3vw, 28px); }
.tutorial-page.has-error img { display: none; }
.tutorial-fallback { margin: 0; padding: 24px; color: #d7f8ff; line-height: 1.7; text-align: center; }
.tutorial-controls { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px; padding-bottom: 2px; }
.tutorial-page-indicator { min-width: 4.5em; color: #fff7ad; text-align: center; font-weight: 700; }
.menu-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }
.primary-button { min-width: 180px; background: #fff7ad; }
.language-control { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; color: #d7f8ff; }
.language-control select { min-height: 44px; padding: 8px 12px; border: 1px solid rgba(223, 248, 255, 0.5); border-radius: 6px; background: #f7fbff; color: #05222b; font: inherit; }
.audio-settings { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.fullscreen-button[hidden] { display: none !important; }
.game-screen { position: fixed; inset: 0; z-index: 4; box-sizing: border-box; width: auto; height: auto; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); display: grid; place-items: center; overflow: hidden; }
.game-container { width: 1280px; height: 720px; flex: 0 0 auto; aspect-ratio: auto; transform-origin: top left; }
.secondary-float-button { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 10; opacity: 0.86; }

@media (max-height: 520px) and (orientation: landscape) {
  .menu-screen { padding: 12px 20px; }
  .menu-screen h1 { margin: 4px 0; font-size: clamp(26px, 7vh, 42px); }
  .lead { margin: 4px 0; line-height: 1.25; }
  .menu-actions { gap: 8px; margin-top: 10px; }
  .language-control { margin-top: 8px; }
  .audio-settings { gap: 6px; margin-top: 6px; }
  .standalone-note { margin: 6px 0 0; }
}

@media (max-width: 640px) {
  .tutorial-controls { gap: 5px; }
  .tutorial-controls button { padding-inline: 12px; }
}
