:root {
  color-scheme: light;
  --ink: #061d16;
  --muted: #62766e;
  --green: #1da85b;
  --green-deep: #0c6d43;
  --blue: #2f7cf6;
  --cream: #fff6ce;
  --line: rgba(7, 79, 48, 0.15);
  --shadow: 0 22px 70px rgba(10, 67, 44, 0.2);
  --radius: 8px;
  font-family:
    Inter, "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", Meiryo,
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f8fff4;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(47, 124, 246, 0.16), transparent 20rem),
    radial-gradient(circle at 84% 14%, rgba(255, 218, 99, 0.28), transparent 20rem),
    linear-gradient(180deg, #fbfff5 0%, #d9f8b0 44%, #86d36f 100%);
}

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

button {
  font: inherit;
}

.game-nav {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 10px max(16px, calc((100vw - 1060px) / 2));
  background: rgba(255, 255, 255, 0.74);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px) saturate(1.35);
}

.brand-link strong {
  font-size: 1.12rem;
  font-weight: 1000;
  letter-spacing: 0;
}

.brand-link span {
  color: var(--green);
}

.room-link {
  display: inline-grid;
  min-height: 36px;
  place-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--green-deep);
  font-size: 0.78rem;
  font-weight: 1000;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 0 0 1px var(--line);
}

.tilt-shell {
  display: grid;
  min-height: calc(100vh - 62px);
  place-items: start center;
  padding: 24px 16px 54px;
}

.tilt-machine {
  width: min(100%, 1060px);
}

.title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.title-row p {
  margin: 0 0 5px;
  color: var(--green-deep);
  font-size: 0.85rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.title-row h1 {
  margin: 0;
  color: #08351f;
  font-size: clamp(2.3rem, 7vw, 5.3rem);
  font-weight: 1000;
  line-height: 0.9;
  letter-spacing: 0;
}

.best-card {
  min-width: 132px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 12px 28px rgba(10, 85, 50, 0.12);
  text-align: right;
}

.best-card span,
.hud-row span,
.ad-slot span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 1000;
  line-height: 1;
  text-transform: uppercase;
}

.best-card strong {
  display: block;
  margin-top: 5px;
  color: var(--blue);
  font-size: 1.32rem;
  font-weight: 1000;
  line-height: 1;
}

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

.hud-row div {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 12px 30px rgba(10, 85, 50, 0.1);
}

.hud-row strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 1000;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-frame {
  position: relative;
  width: min(100%, 620px);
  margin: 0 auto;
  overflow: hidden;
  border: 6px solid rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  background: #70d56a;
  box-shadow: var(--shadow);
  touch-action: none;
}

#tilt-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 620 / 860;
  background: #78d970;
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 22px;
  color: #fff;
  background: linear-gradient(180deg, rgba(2, 24, 18, 0.08), rgba(2, 24, 18, 0.54));
  text-align: center;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.32);
}

.game-overlay[hidden] {
  display: none;
}

.game-overlay p {
  margin: 0 0 7px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.game-overlay strong {
  font-size: clamp(2.4rem, 9vw, 5.2rem);
  font-weight: 1000;
  line-height: 0.94;
}

.overlay-actions,
.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.overlay-actions {
  margin-top: 22px;
}

.control-row {
  margin: 16px 0 12px;
}

.game-overlay button,
.secondary-button {
  display: inline-grid;
  min-height: 48px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  font-weight: 1000;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    filter 0.16s ease;
}

.game-overlay button {
  min-width: 148px;
  padding: 0 24px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 14px 32px rgba(21, 92, 213, 0.24);
}

#sensor-button {
  color: #0a7445;
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 12px 28px rgba(11, 85, 50, 0.14);
}

.secondary-button {
  min-width: 132px;
  padding: 0 20px;
  color: #0a7445;
  background: rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 12px 28px rgba(11, 85, 50, 0.14);
}

.game-overlay button:hover,
.secondary-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.ad-slot {
  display: grid;
  min-height: 70px;
  place-items: center;
  border: 1px dashed rgba(16, 112, 67, 0.26);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.ad-slot small {
  margin-top: 3px;
  color: #7c9087;
  font-weight: 800;
}

@media (max-width: 720px) {
  .tilt-shell {
    padding: 16px 10px 42px;
  }

  .title-row {
    align-items: start;
  }

  .best-card {
    min-width: 104px;
    padding: 9px 10px;
  }

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

  .course-frame {
    border-width: 4px;
    border-radius: 12px;
  }
}

@media (max-width: 430px) {
  .game-nav {
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand-link strong {
    font-size: 1rem;
  }

  .room-link {
    padding: 0 11px;
  }

  .title-row h1 {
    font-size: clamp(2rem, 13vw, 3rem);
  }

  .best-card {
    min-width: 92px;
  }

  .hud-row strong {
    font-size: 1rem;
  }

  .game-overlay button,
  .secondary-button {
    min-width: 124px;
  }
}
