:root {
  background: #f7f2e8;
  color: #1f1f1f;
  color-scheme: light;
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f7f2e8;
  color: #1f1f1f;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

#app {
  min-height: 100vh;
}

.shell,
.game-shell {
  box-sizing: border-box;
  min-height: 100vh;
  padding: 2rem;
}

.shell {
  display: grid;
  place-items: center;
}

.hero-card,
.panel {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #d4c5ac;
  border-radius: 1.5rem;
  box-shadow: 0 20px 50px rgba(83, 55, 22, 0.08);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.hero-card {
  max-width: 34rem;
  padding: 3rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: #8e3423;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.hero-copy,
.status-message,
.share-url,
.connection-status,
.rack-empty-message {
  color: #4f4a43;
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.toolbar-button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.4rem;
  cursor: pointer;
}

.primary-button {
  background: #8e3423;
  color: #ffffff;
}

.secondary-button,
.toolbar-button {
  background: #325f8f;
  color: #ffffff;
}

.secondary-button--ghost {
  background: #e7eef7;
  color: #284b71;
}

.toolbar-button {
  padding: 0.55rem 1rem;
}

.toolbar-button--active {
  background: #8e3423;
}

.game-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.connection-status {
  font-weight: 700;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
}

.bag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  background: #f0dcc1;
  color: #5d3d20;
  font-weight: 700;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(19rem, 22rem) minmax(0, 1fr) minmax(22rem, 28rem);
  gap: 1.5rem;
  align-items: start;
}

.control-column {
  display: grid;
  gap: 1rem;
}

.panel {
  padding: 1.5rem;
}

.form-field {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.form-field input {
  border: 1px solid #ccb89b;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  background: #fffaf1;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.seat-card {
  padding: 1rem;
  border: 1px solid #e4d5bb;
  border-radius: 1rem;
  background: #fffaf2;
}

.seat-card.claimed {
  background: #f4e1db;
  border-color: #d39a8c;
}

.claimed-banner {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 1rem;
  background: #edf3e7;
  border: 1px solid #b6c8a3;
}

.play-area-panel {
  padding: 1.25rem;
}

.play-surface {
  position: relative;
  display: grid;
  gap: 1rem;
}

.board-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9.5rem;
  gap: 1rem;
  align-items: start;
}

.rack-panel {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 1.2rem;
  background: #f9f1e3;
  border: 1px solid #e4d4ba;
}

.rack-panel--owner {
  border-color: #d39a8c;
  background: #fff7f1;
}

.rack-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.rack-slots {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.55rem;
  justify-content: center;
  overflow-x: auto;
  padding-bottom: 0.1rem;
}

.rack-slots--hidden {
  min-height: 4rem;
  justify-content: center;
}

.rack-slot {
  width: 3.6rem;
  min-width: 3.6rem;
  min-height: 4.2rem;
  border-radius: 1rem;
  border: 1px dashed #d3c3aa;
  background: #f8f0e0;
  display: grid;
  place-items: center;
  padding: 0.2rem;
  box-sizing: border-box;
}

.tile {
  width: 46px;
  min-width: 46px;
  height: 46px;
  border: 1px solid #9c824d;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #f7deb0 0%, #efd19a 100%);
  box-shadow: 0 4px 10px rgba(84, 54, 19, 0.18);
  color: #4d3812;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 0.25rem;
  position: relative;
  box-sizing: border-box;
}

.rack-tile {
  cursor: grab;
}

.board-tile {
  position: absolute;
  left: 0;
  top: 0;
  cursor: grab;
}

.tile-letter {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.tile-letter--hidden::before {
  content: '≋';
  font-size: 1rem;
  color: rgba(77, 56, 18, 0.66);
}

.tile-value {
  position: absolute;
  bottom: 0.28rem;
  right: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
}

.tile--hidden {
  background: linear-gradient(180deg, #c69e6e 0%, #a87b4c 100%);
  border-style: solid;
}

.tile--drag-source {
  visibility: hidden;
}

.tile--preview {
  position: absolute;
  pointer-events: none;
  z-index: 4;
}

.tile--local-preview {
  box-shadow: 0 10px 20px rgba(83, 55, 22, 0.28);
}

.tile--remote-preview {
  opacity: 0.92;
}

.board-panel {
  display: grid;
  justify-items: center;
}

.board-panel--highlighted,
.bag-dock--highlighted {
  box-shadow: 0 0 0 3px rgba(142, 52, 35, 0.18);
  border-radius: 1rem;
}

.board-shell {
  display: grid;
  justify-content: center;
}

.board-grid {
  position: relative;
  width: 690px;
  height: 690px;
  display: grid;
  grid-template-columns: repeat(15, 46px);
  grid-template-rows: repeat(15, 46px);
  background: #e7d1ac;
  border: 1px solid #b79258;
  border-radius: 1rem;
  overflow: hidden;
}

.board-cell {
  display: grid;
  place-items: center;
  background: #f5e9c9;
  border: 1px solid rgba(133, 101, 53, 0.25);
  font-size: 0.72rem;
  font-weight: 700;
  color: #5a4631;
}

.board-cell--triple-word {
  background: #b33a32;
  color: #ffffff;
}

.board-cell--double-word,
.board-cell--center {
  background: #e4a5b0;
}

.board-cell--triple-letter {
  background: #386fa6;
  color: #ffffff;
}

.board-cell--double-letter {
  background: #9ed1ea;
}

.board-drop-zone {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.board-tiles-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.board-tiles-layer .tile {
  pointer-events: auto;
}

.bag-dock {
  padding: 0.6rem;
  border: 1px solid #ead9bd;
  border-radius: 1.2rem;
  background: #fff8eb;
}

.bag-button {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  padding: 1.25rem 1rem;
  border-radius: 1rem;
  background: #8e5a22;
  color: #ffffff;
  cursor: grab;
  user-select: none;
  box-sizing: border-box;
}

.bag-button strong {
  font-size: 1.5rem;
}

.bag-button--empty {
  background: #8a877f;
}

.bag-button--disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.bag-button-title {
  font-weight: 700;
}

.bag-button small {
  color: rgba(255, 255, 255, 0.88);
}

.play-surface-overlays {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.score-panel {
  display: grid;
  gap: 1rem;
}

.score-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.score-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.score-surface-scroll {
  max-width: 100%;
  max-height: 36rem;
  overflow: auto;
  border: 1px solid #d8cdb7;
  border-radius: 1rem;
  background: #fffdf7;
  cursor: grab;
}

.score-surface-stage {
  position: relative;
}

.score-surface {
  display: block;
  cursor: crosshair;
}

.score-surface-background {
  fill: #fffdf7;
}

.score-grid-line {
  stroke: #eadfcb;
  stroke-width: 1;
}

.score-stroke {
  fill: none;
  stroke: #355c7d;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.score-stroke--draft,
.score-stroke--preview {
  stroke: #8e3423;
}

.score-stroke--preview {
  opacity: 0.55;
}

.score-text {
  fill: #2d2419;
  font-size: 22px;
  font-weight: 600;
  dominant-baseline: hanging;
}

.score-text-editor {
  position: absolute;
  min-width: 8rem;
  border: 0;
  border-bottom: 2px solid #8e3423;
  background: transparent;
  padding: 0.1rem 0;
  color: #2d2419;
  transform: translateY(-2px);
  outline: none;
}

.notice-message {
  color: #6b4f19;
}

.error-message {
  color: #8b1e1e;
}

@media (max-width: 1700px) {
  .workspace-layout {
    grid-template-columns: minmax(19rem, 22rem) minmax(0, 1fr);
  }

  .score-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1280px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .board-row {
    grid-template-columns: 1fr;
  }

  .bag-dock {
    justify-self: center;
    width: min(18rem, 100%);
  }
}

@media (max-width: 900px) {
  .game-header,
  .seat-grid,
  .header-actions,
  .score-panel-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .board-grid {
    transform: scale(0.82);
    transform-origin: top center;
  }
}
