:root {
  --coin-bg: #eef5ef;
  --coin-bg-strong: #dce8df;
  --coin-ink: #1e2a30;
  --coin-muted: #5a6771;
  --coin-card: rgba(249, 255, 251, 0.84);
  --coin-line: rgba(30, 42, 48, 0.1);
  --coin-head: #2f7d5d;
  --coin-tail: #bb7a3d;
  --coin-accent: #4f9c76;
  --coin-accent-deep: #245d43;
  --coin-shadow: 0 22px 56px rgba(36, 93, 67, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(79, 156, 118, 0.16), transparent 24%),
    radial-gradient(circle at bottom right, rgba(36, 93, 67, 0.14), transparent 28%),
    linear-gradient(180deg, var(--coin-bg), var(--coin-bg-strong));
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--coin-ink);
  font-family: "Avenir Next", "SF Pro Display", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

.coin-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  min-height: 100vh;
  padding: max(24px, env(safe-area-inset-top)) 20px max(120px, calc(120px + env(safe-area-inset-bottom))) 20px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.coin-hero,
.coin-panel,
.coin-floating-stats {
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: var(--coin-card);
  backdrop-filter: blur(16px);
  box-shadow: var(--coin-shadow);
}

.coin-hero,
.coin-panel {
  border-radius: 26px;
}

.coin-hero {
  padding: 28px;
}

.coin-panel {
  padding: 24px;
  min-width: 0;
}

.coin-panel-home {
  max-width: 560px;
}

.coin-game-shell {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.coin-kicker,
.coin-tag {
  margin: 0 0 10px;
  color: var(--coin-accent-deep);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.coin-hero h1,
.coin-panel h2 {
  margin: 0;
}

.coin-hero h1 {
  font-size: clamp(2rem, 8vw, 4.2rem);
  line-height: 1.04;
  max-width: 12ch;
}

.coin-copy,
.coin-feedback,
.coin-stat-card span,
.coin-inline-card p:last-child,
.coin-history-chip span {
  color: var(--coin-muted);
}

.coin-copy {
  margin: 12px 0 0;
  line-height: 1.65;
}

.coin-panel-header {
  margin-bottom: 20px;
}

.coin-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.coin-badge {
  margin: 0;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(207, 106, 51, 0.1);
  color: var(--coin-accent-deep);
  font-weight: 800;
}

.coin-field {
  display: grid;
  gap: 10px;
}

.coin-form-stack {
  display: grid;
  gap: 16px;
}

.coin-field span {
  font-size: 0.94rem;
  font-weight: 700;
}

.coin-field input {
  width: 100%;
  min-height: 56px;
  border-radius: 18px;
  border: 1.5px solid var(--coin-line);
  background: rgba(255, 255, 255, 0.88);
  padding: 0 16px;
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.coin-field input:focus {
  border-color: rgba(79, 156, 118, 0.64);
  box-shadow: 0 0 0 4px rgba(79, 156, 118, 0.12);
  transform: translateY(-1px);
}

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

.coin-otp-digit {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 1.5px solid var(--coin-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  text-align: center;
  font-size: clamp(1.5rem, 6vw, 2.15rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  aspect-ratio: 1 / 1.08;
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.coin-otp-digit:focus {
  border-color: rgba(79, 156, 118, 0.72);
  box-shadow: 0 0 0 4px rgba(79, 156, 118, 0.12);
  transform: translateY(-1px);
}

.coin-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;
}

.coin-inline-card {
  margin-top: 12px;
  border-radius: 20px;
  border: 1px solid var(--coin-line);
  background: rgba(255, 255, 255, 0.76);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.coin-secondary-button,
.coin-primary-button {
  border: none;
  cursor: pointer;
}

.coin-secondary-button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(139, 61, 25, 0.18);
  background: rgba(255, 255, 255, 0.9);
  color: var(--coin-accent-deep);
  font-weight: 800;
}

.coin-secondary-button-strong {
  min-height: 56px;
  padding: 0 18px;
  font-size: 1rem;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--coin-accent), var(--coin-accent-deep));
  color: #f4fffd;
  border: none;
  box-shadow: 0 16px 32px rgba(139, 61, 25, 0.22);
}

.coin-entry-card {
  margin-top: 22px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(246, 253, 248, 0.96), rgba(228, 242, 233, 0.88));
  border: 1px solid rgba(36, 93, 67, 0.12);
  display: grid;
  gap: 12px;
}

.coin-entry-card h3 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.coin-primary-link {
  min-height: 56px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  text-decoration: none;
  color: #fff8f1;
  font-weight: 800;
  background: linear-gradient(135deg, var(--coin-accent), var(--coin-accent-deep));
  box-shadow: 0 16px 32px rgba(139, 61, 25, 0.22);
}

.coin-feedback {
  min-height: 22px;
  margin: 12px 0 0;
}

.coin-feedback.success {
  color: var(--coin-head);
}

.coin-feedback.error {
  color: #b83232;
}

.coin-panel-header .coin-copy:empty,
#coinRulesText:empty {
  display: none;
}

.coin-history-strip {
  display: flex;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.coin-history-chip {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 14px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--coin-line);
  display: grid;
  gap: 4px;
  justify-items: center;
}

.coin-history-strip > .coin-copy {
  flex: 0 0 auto;
}

.coin-history-chip.is-head {
  background: rgba(47, 133, 90, 0.14);
}

.coin-history-chip.is-tail {
  background: rgba(192, 86, 33, 0.12);
}

.coin-history-chip strong {
  font-size: 1.4rem;
}

.coin-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.coin-stat-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--coin-line);
  background: rgba(255, 255, 255, 0.8);
  display: grid;
  gap: 6px;
}

.coin-stat-card strong {
  font-size: 1.8rem;
}

.coin-floating-stats {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 12px;
  z-index: 3;
  border-radius: 20px;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}

.coin-floating-stats p {
  margin: 0;
  display: grid;
  gap: 2px;
  text-align: right;
}

.coin-floating-stats strong {
  font-size: 1.05rem;
}

.coin-floating-stats span {
  color: var(--coin-muted);
  font-size: 0.76rem;
}

.coin-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(238, 244, 234, 0), rgba(238, 244, 234, 0.96) 35%);
  z-index: 4;
}

.coin-primary-button {
  width: min(100%, 1120px);
  margin: 0 auto;
  display: block;
  min-height: 62px;
  border-radius: 22px;
  padding: 0 20px;
  color: #f4fffd;
  font-size: 1.06rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--coin-accent), var(--coin-accent-deep));
  box-shadow: 0 18px 32px rgba(11, 79, 74, 0.22);
}

.coin-primary-button:disabled {
  opacity: 0.65;
}

.hidden {
  display: none;
}

@media (min-width: 900px) {
  .coin-shell {
    grid-template-columns: 1.1fr 0.9fr;
    grid-template-areas:
      "hero login"
      "game game";
  }

  .coin-hero {
    grid-area: hero;
    min-height: 100%;
  }

  .coin-panel-home {
    grid-area: login;
  }

  .coin-game-shell {
    grid-area: game;
  }
}

@media (max-width: 520px) {
  .coin-floating-stats {
    top: auto;
    right: 16px;
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}
