:root {
  --bg: #f7efe4;
  --bg-accent: #ffd7a8;
  --surface: rgba(255, 252, 247, 0.88);
  --surface-strong: #fff9f1;
  --text: #1b1714;
  --muted: #6f6257;
  --primary: #d35400;
  --primary-dark: #8f2d00;
  --secondary: #174a59;
  --line: rgba(27, 23, 20, 0.12);
  --shadow: 0 20px 60px rgba(67, 37, 13, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 215, 168, 0.95), transparent 28%),
    radial-gradient(circle at right center, rgba(23, 74, 89, 0.08), transparent 24%),
    linear-gradient(180deg, #fff9f1 0%, var(--bg) 100%);
  min-height: 100vh;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.hero,
.section,
.footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 72px 0 48px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.hero-copy-block {
  padding-right: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--primary-dark);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.9rem, 8vw, 5.7rem);
  line-height: 0.95;
  max-width: 10ch;
  margin-bottom: 18px;
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  margin-bottom: 14px;
}

h3 {
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.hero-copy,
.card p,
.game-meta,
.game-hint,
.footer,
.play-link {
  color: var(--muted);
  line-height: 1.7;
}

.hero-copy {
  font-size: 1.15rem;
  max-width: 48rem;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.button:hover,
.game-card:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: var(--primary);
  color: white;
  border-color: transparent;
}

.button.secondary {
  background: var(--surface);
  backdrop-filter: blur(12px);
}

.button.small {
  padding: 10px 14px;
  font-size: 0.95rem;
}

.section {
  padding: 20px 0 56px;
}

.section-heading {
  margin-bottom: 20px;
}

.intro,
.hosting-grid,
.game-grid,
.game-meta-grid {
  display: grid;
  gap: 18px;
}

.intro,
.hosting-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.game-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.game-meta-grid {
  grid-template-columns: 1.1fr minmax(0, 1.5fr);
  align-items: start;
}

.card,
.game-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-stats {
  padding-top: 28px;
}

.hero-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.hero-stat-row strong {
  font-size: 1.2rem;
}

.hero-stat-row:first-of-type {
  border-top: 0;
  padding-top: 6px;
}

.game-card {
  display: flex;
  flex-direction: column;
  min-height: 240px;
}

.play-link {
  margin-top: auto;
  font-weight: 700;
  color: var(--secondary);
}

.tag {
  display: inline-block;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(211, 84, 0, 0.1);
  color: var(--primary-dark);
  font-size: 0.8rem;
  margin-bottom: 14px;
}

.footer {
  padding: 8px 0 42px;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.page-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.page-topbar p {
  margin: 0;
  color: var(--muted);
}

.game-stage {
  display: grid;
  gap: 18px;
}

.game-panel {
  display: grid;
  gap: 18px;
}

.game-summary h1 {
  max-width: none;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  margin-bottom: 12px;
}

.game-meta-list,
.game-controls {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.game-meta-list li,
.game-controls li {
  margin-bottom: 10px;
}

.game-shell {
  display: grid;
  gap: 18px;
}

.scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.score-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(23, 74, 89, 0.08);
  color: var(--secondary);
  font-weight: 700;
}

.canvas-card {
  padding: 20px;
}

.game-canvas {
  display: block;
  width: min(100%, 640px);
  margin: 0 auto;
  border-radius: 20px;
  border: 1px solid rgba(27, 23, 20, 0.15);
  background: #08131a;
}

.game-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.touch-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.touch-controls.center {
  justify-content: center;
}

.status-copy {
  color: var(--secondary);
  font-weight: 700;
}

.game-hint {
  margin: 0;
  text-align: center;
}

.hidden {
  display: none !important;
}

code {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(23, 74, 89, 0.08);
  font-size: 0.95em;
}

.sheet-page {
  background:
    linear-gradient(180deg, #eff3ef 0%, #dde7dc 100%);
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
}

.sheet-page .page-shell {
  width: min(1480px, calc(100% - 20px));
}

.sheet-app {
  border: 1px solid rgba(23, 45, 32, 0.12);
  border-radius: 24px;
  overflow: hidden;
  background: #f7faf7;
  box-shadow: 0 24px 70px rgba(40, 74, 45, 0.16);
}

.sheet-header {
  background: linear-gradient(180deg, #1f7d4d 0%, #17663f 100%);
  color: white;
  padding: 16px 20px;
}

.sheet-header-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.sheet-header p,
.sheet-header h1,
.sheet-header strong {
  color: white;
  margin: 0;
}

.sheet-header h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.05;
  max-width: none;
}

.sheet-ribbon-tabs,
.sheet-toolbar,
.sheet-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.sheet-ribbon-tab,
.sheet-tool-button,
.sheet-tab-button,
.sheet-add-tab {
  border: 1px solid rgba(18, 43, 27, 0.12);
  border-radius: 12px;
  background: white;
  color: #203324;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.sheet-ribbon-tab,
.sheet-tool-button,
.sheet-tab-button {
  padding: 8px 12px;
}

.sheet-ribbon-tab.active,
.sheet-tab-button.active {
  background: #daf0df;
  border-color: rgba(31, 125, 77, 0.3);
  color: #155233;
}

.sheet-tool-button {
  font-weight: 700;
}

.sheet-tool-button:hover,
.sheet-tab-button:hover,
.sheet-add-tab:hover,
.sheet-ribbon-tab:hover {
  transform: translateY(-1px);
}

.sheet-surface {
  background: #f7faf7;
}

.sheet-bar {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 180px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(23, 45, 32, 0.1);
  background: #eef5ee;
}

.name-box,
.formula-input,
.sheet-search {
  border: 1px solid rgba(23, 45, 32, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
  min-height: 44px;
}

.name-box {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #155233;
}

.formula-wrap {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.formula-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 10px;
  background: white;
  border: 1px solid rgba(23, 45, 32, 0.12);
  color: #155233;
  font-weight: 700;
}

.formula-input,
.sheet-search {
  width: 100%;
}

.sheet-grid-wrap {
  overflow: auto;
  background: white;
  max-height: 68vh;
}

.sheet-grid {
  border-collapse: collapse;
  min-width: 1220px;
  width: 100%;
  table-layout: fixed;
}

.sheet-grid th,
.sheet-grid td {
  border: 1px solid #d8e2d8;
  padding: 0;
}

.sheet-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f6f3;
  font-weight: 700;
  color: #406146;
  text-align: center;
  height: 34px;
}

.sheet-row-head {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f3f6f3;
  width: 54px;
  min-width: 54px;
  text-align: center;
  color: #406146;
  font-weight: 700;
}

.sheet-corner {
  left: 0;
  z-index: 3;
}

.sheet-cell {
  min-width: 106px;
  width: 106px;
  height: 30px;
  padding: 4px 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: cell;
  color: #203324;
  background: white;
  font-size: 1rem;
}

.sheet-cell.numeric {
  text-align: right;
}

.sheet-cell.selected {
  outline: 2px solid #1f7d4d;
  outline-offset: -2px;
  background: #f2fbf5;
}

.sheet-cell.editing {
  padding: 0;
}

.sheet-cell-editor {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 4px 8px;
  outline: 2px solid #1f7d4d;
  font: inherit;
}

.sheet-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid rgba(23, 45, 32, 0.1);
  background: #edf4ed;
}

.sheet-tabs {
  min-height: 40px;
}

.sheet-tab-button {
  min-width: 88px;
}

.sheet-add-tab {
  width: 38px;
  height: 38px;
  font-size: 1.2rem;
  line-height: 1;
}

.sheet-status {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: #4f6854;
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .sheet-bar {
    grid-template-columns: 1fr;
  }

  .sheet-bottom,
  .sheet-header-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .sheet-search {
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  .hero,
  .game-meta-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy-block {
    padding-right: 0;
  }
}

@media (max-width: 640px) {
  .hero {
    padding-top: 52px;
  }

  .page-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .canvas-card {
    padding: 16px;
  }
}
