@import url("tokens.css");

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  position: fixed;
  inset: 0;
  padding:
    calc(10px + var(--safe-top))
    calc(12px + var(--safe-right))
    calc(12px + var(--safe-bottom))
    calc(12px + var(--safe-left));
  -webkit-font-smoothing: antialiased;
}

.game-topbar {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 8px 10px 8px 6px;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  outline: none;
}

.back-link svg {
  width: 16px;
  height: 16px;
}

.game-identity {
  text-align: right;
  min-width: 0;
}

.game-identity h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.game-identity p {
  font-size: 0.8rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px var(--shadow);
  overflow: hidden;
}

.game-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.game-overlay {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid rgba(21, 38, 54, 0.06);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  text-align: center;
  box-shadow: 0 -10px 30px var(--shadow-strong);
  z-index: 10;
  animation: slideUp 0.35s var(--ease-out);
}

.game-overlay.is-visible {
  display: block;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.overlay-copy {
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 16px;
  font-weight: 600;
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.overlay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.overlay-btn-primary {
  background: var(--ink);
  color: var(--surface);
}

.overlay-btn-secondary {
  background: #fff;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.overlay-btn-coffee {
  background: #ffdd00;
  color: #000;
  box-shadow: 0 4px 14px rgba(255, 221, 0, 0.35);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
