/* Light pixel board game base styles */
:root {
  --bg: #f6f3e7;
  --panel: #fff6d8;
  --panel-border: #e7d9b0;
  --fg: #2b2b2b;
  --accent: #38bdf8;
  --accent-2: #f59e0b;
  --shadow: #c9bfa5;
  --grass: #b9e38d;
  --fairway: #a7d76d;
  --trees: #6fbf73;
  --bushes: #8ed08b;
  --hazard: #ffb86b;
  --hazard-dark: #f39b45;
  --oob: #f5a3a3;
  --oob-dark: #e57373;
  --water: #8ed1f0;
  --water-dark: #63b8e6;
  --sand: #f4d06f;
  --tee: #fde68a;
  --tee-dark: #f4c95d;
  --basket: #fde047;
  --basket-dark: #f7c948;
  --basket-ring: rgba(180, 83, 9, 0.58);
  --basket-ring-inner: rgba(180, 83, 9, 0.46);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  background: repeating-linear-gradient(
    45deg,
    #f6f3e7,
    #f6f3e7 12px,
    #f9f7ee 12px,
    #f9f7ee 24px
  );
  color: var(--fg);
}

a {
  color: inherit;
}

#app.dashboard {
  min-height: 100vh;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  --editor-viewport-offset: 240px;
}

.editor-layout.editor-layout-three {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
}

.game-layout {
  --game-viewport-offset: 240px;
  align-items: start;
  flex: 1;
  min-height: 0;
  height: 100%;
  margin-top: 0;
}

.editor-col {
  display: grid;
  gap: 16px;
  align-content: start;
}

.game-layout .editor-col-main {
  min-height: 0;
}

.game-col-actions {
  max-height: calc(100vh - var(--game-viewport-offset));
  overflow: auto;
  padding: 2px 4px 8px 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.game-col-actions::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.editor-col-palette {
  max-height: calc(100vh - var(--editor-viewport-offset));
  overflow: auto;
  padding: 2px 4px 8px 2px;
}

.editor-col-palette {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.editor-col-palette::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.editor-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.multiplayer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-top: 8px;
}

.multiplayer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  margin-top: 6px;
}

.editor-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.editor-field input[type="checkbox"] {
  justify-self: start;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-input {
  font-family: inherit;
  font-size: 14px;
  border: 3px solid #111;
  background: #fff;
  padding: 6px 8px;
}

.editor-readonly {
  border: 3px solid #111;
  background: #fef3c7;
  padding: 6px 8px;
  font-size: 14px;
}

.editor-grid-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.editor-grid-controls .pixel-btn {
  grid-column: 1 / -1;
  justify-self: start;
}

.editor-palette {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

.palette-item {
  border: 3px solid #111;
  width: 72px;
  height: 72px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: grab;
  font-size: 12px;
}

.palette-item.is-inactive {
  opacity: 0.5;
  filter: grayscale(0.3);
}

.palette-item.is-active {
  outline: 3px solid var(--accent-2);
}

.palette-item.grass { background: var(--grass); }
.palette-item.fairway { background: var(--fairway); }
.palette-item.trees { background: var(--trees); }
.palette-item.bushes { background: var(--bushes); }
.palette-item.hazard {
  background: repeating-linear-gradient(
    45deg,
    var(--hazard) 0,
    var(--hazard) 8px,
    var(--hazard-dark) 8px,
    var(--hazard-dark) 16px
  );
}
.palette-item.oob {
  background: repeating-linear-gradient(
    45deg,
    var(--oob) 0,
    var(--oob) 8px,
    var(--oob-dark) 8px,
    var(--oob-dark) 16px
  );
}
.palette-item.water {
  background: repeating-linear-gradient(
    45deg,
    var(--water) 0,
    var(--water) 8px,
    var(--water-dark) 8px,
    var(--water-dark) 16px
  );
}
.palette-item.sand { background: var(--sand); }
.palette-item.tee {
  background: repeating-linear-gradient(
    0deg,
    var(--tee) 0,
    var(--tee) 8px,
    var(--tee-dark) 8px,
    var(--tee-dark) 16px
  );
}
.palette-item.basket {
  background:
    radial-gradient(circle at center, transparent 0 18%, var(--basket-ring-inner) 19% 31%, transparent 32% 100%),
    radial-gradient(circle at center, transparent 0 52%, var(--basket-ring) 53% 69%, transparent 70% 100%),
    repeating-linear-gradient(
      45deg,
      var(--basket) 0,
      var(--basket) 8px,
      var(--basket-dark) 8px,
      var(--basket-dark) 16px
    );
}
.palette-item.erase { background: #fecaca; }

.palette-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.palette-desc {
  font-size: 12px;
  opacity: 0.85;
}

.editor-board {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  background: #fff;
  border: 3px solid #111;
  padding: 6px;
  min-height: 260px;
  --rows: 15;
  --cols: 12;
  max-height: calc(100vh - var(--editor-viewport-offset));
  width: min(100%, calc((100vh - var(--editor-viewport-offset)) * (var(--cols) / var(--rows))));
}

.editor-tile {
  border: 2px solid #111;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--grass);
  position: relative;
}

.editor-tile.grass { background: var(--grass); }
.editor-tile.fairway { background: var(--fairway); }
.editor-tile.trees { background: var(--trees); }
.editor-tile.bushes { background: var(--bushes); }
.editor-tile.hazard {
  background: repeating-linear-gradient(
    45deg,
    var(--hazard) 0,
    var(--hazard) 8px,
    var(--hazard-dark) 8px,
    var(--hazard-dark) 16px
  );
}
.editor-tile.oob {
  background: repeating-linear-gradient(
    45deg,
    var(--oob) 0,
    var(--oob) 8px,
    var(--oob-dark) 8px,
    var(--oob-dark) 16px
  );
}
.editor-tile.water {
  background: repeating-linear-gradient(
    45deg,
    var(--water) 0,
    var(--water) 8px,
    var(--water-dark) 8px,
    var(--water-dark) 16px
  );
}
.editor-tile.sand { background: var(--sand); }
.editor-tile.tee {
  background: repeating-linear-gradient(
    0deg,
    var(--tee) 0,
    var(--tee) 8px,
    var(--tee-dark) 8px,
    var(--tee-dark) 16px
  );
}
.editor-tile.basket {
  background:
    radial-gradient(circle at center, transparent 0 18%, var(--basket-ring-inner) 19% 31%, transparent 32% 100%),
    radial-gradient(circle at center, transparent 0 52%, var(--basket-ring) 53% 69%, transparent 70% 100%),
    repeating-linear-gradient(
      45deg,
      var(--basket) 0,
      var(--basket) 8px,
      var(--basket-dark) 8px,
      var(--basket-dark) 16px
    );
}

.editor-tile-label {
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 10px;
}

.editor-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.hole-list {
  display: grid;
  gap: 8px;
}

.saved-courses {
  margin-top: 12px;
}

.course-list {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.course-card {
  border: 3px solid #111;
  background: #fff;
  padding: 8px;
  box-shadow: 3px 3px 0 #111;
}

.start-course-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.start-course-search {
  margin: 6px 0 10px;
}

.start-course-list .hint {
  grid-column: 1 / -1;
}

.start-course-card {
  text-align: left;
  cursor: pointer;
  min-height: 140px;
}

.start-course-card.is-active {
  outline: 3px solid var(--accent-2);
  box-shadow: 0 0 0 3px #111, 3px 3px 0 #111;
}

.hole-card {
  border: 3px solid #111;
  background: #fff;
  padding: 8px;
  box-shadow: 3px 3px 0 #111;
  cursor: grab;
}

.hole-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hole-card.is-dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.hole-title {
  font-size: 14px;
}

.hole-meta,
.hole-desc {
  font-size: 12px;
  opacity: 0.8;
}

.dashboard-grid .full-width {
  grid-column: 1 / -1;
}

.hero {
  background: #fff1c1;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.stat-card {
  background: #fff;
  border: 2px solid #111;
  padding: 8px;
  box-shadow: 3px 3px 0 #111;
}

.stat-title {
  font-size: 12px;
  opacity: 0.8;
}

.stat-value {
  font-size: 22px;
  margin-top: 6px;
}

.dashboard-list {
  margin: 8px 0 0;
  padding-left: 16px;
  font-size: 14px;
  line-height: 1.4;
}

.dashboard-challenges {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.challenge-card {
  border: 2px solid #111;
  padding: 8px;
  background: #fef3c7;
}

.challenge-title {
  font-size: 14px;
  margin-bottom: 6px;
}

.dashboard-roadmap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.roadmap-item {
  background: #fff;
  border: 2px solid #111;
  padding: 8px;
  box-shadow: 3px 3px 0 #111;
}

#app {
  padding: clamp(12px, 2vw, 24px);
  min-height: 100vh;
  height: auto;
}

body.game-page {
  overflow: hidden;
}

body.game-page #app {
  height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.sandbox-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 0;
  padding: 10px 16px;
  grid-column: 1 / -1;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  color: #111827;
  background: repeating-linear-gradient(
    -45deg,
    #fde047,
    #fde047 12px,
    #f59e0b 12px,
    #f59e0b 24px
  );
  border: 2px solid #111827;
  box-shadow: 0 6px 0 #111827;
}

.sandbox-banner__title {
  padding: 4px 10px;
  border-radius: 6px;
  background: #111827;
  color: #fef9c3;
  letter-spacing: 3px;
}

.sandbox-banner__text {
  font-size: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-pixel {
  width: 56px;
  height: 56px;
  background:
    linear-gradient(90deg, #111 6px, transparent 6px),
    linear-gradient(#111 6px, transparent 6px),
    linear-gradient(90deg, #f97316 28px, transparent 28px),
    linear-gradient(#f97316 28px, transparent 28px),
    linear-gradient(90deg, #10b981 44px, transparent 44px),
    linear-gradient(#10b981 44px, transparent 44px);
  background-size: 56px 56px;
  border: 4px solid #111;
  box-shadow: 4px 4px 0 #111;
}

h1 {
  margin: 0;
  font-size: 40px;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 20px;
}

.status {
  display: flex;
  gap: 8px;
}

.menu-wrap {
  position: relative;
}

.menu-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #fff8e6;
  border: 3px solid #111;
  padding: 6px;
  box-shadow: 6px 6px 0 #111;
  display: none;
  min-width: 240px;
  width: max-content;
  max-width: min(90vw, 420px);
  z-index: 5;
}

.menu-panel.is-open {
  display: grid;
  gap: 6px;
}

.menu-item {
  font-family: inherit;
  font-size: 16px;
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  display: block;
  white-space: nowrap;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin: 8px 0 16px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 12px;
  border: 2px solid #1f2937;
  background: #fff7d6;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 3px 3px 0 #1f2937;
}

.auth-tab.is-active {
  background: #fde68a;
}

.auth-panel {
  display: none;
}

.auth-panel.is-active {
  display: block;
}

.auth-status {
  margin-top: 10px;
  font-size: 14px;
}

.auth-status.error {
  color: #b91c1c;
}

.auth-status.success {
  color: #047857;
}

.auth-status.warn {
  color: #b45309;
}

.social-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.social-icon {
  width: 15px;
  height: 15px;
  color: #111;
  flex: 0 0 auto;
}

.status-pill {
  display: inline-block;
  padding: 2px 6px;
  border: 2px solid #111;
  background: #fff;
  font-size: 12px;
  margin-left: 6px;
}

.status-pill.online {
  background: #bbf7d0;
}

.status-pill.offline {
  background: #e5e7eb;
}

.status-pill.pending {
  background: #fde68a;
}

.topbar-btn {
  font-size: 16px;
  padding: 6px 10px;
}

.scorecard {
  grid-column: 1 / -1;
  background: var(--panel);
  border: 3px solid var(--panel-border);
  padding: 8px;
  box-shadow: 4px 4px 0 var(--shadow);
  overflow-x: auto;
}

.scorecard table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
  font-size: 16px;
}

.scorecard th,
.scorecard td {
  border: 2px solid #111;
  padding: 4px 6px;
  text-align: center;
  background: #fef3c7;
}

.scorecard th {
  background: #f9e6a6;
}

.scorecard .player-cell {
  text-align: left;
  min-width: 90px;
}


.scorecard .over-par {
  background: #fecaca;
}

.card-editor-layout {
  gap: 16px;
}

.card-editor-status {
  margin: 8px 0 12px;
  font-size: 14px;
  color: #e9e3b0;
}

.card-editor-status.is-error {
  color: #fecaca;
}

.card-editor-table-wrap {
  overflow: auto;
  border: 2px solid #111;
  background: #fef3c7;
}

.card-editor-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1200px;
  font-size: 12px;
}

.card-editor-table th,
.card-editor-table td {
  border: 2px solid #111;
  padding: 6px;
  background: #fef3c7;
  vertical-align: top;
}

.card-editor-table th {
  position: sticky;
  top: 0;
  background: #f9e6a6;
  z-index: 1;
}

.card-editor-tabs {
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
}

.card-editor-tabs .pixel-btn.is-active {
  background: #fde68a;
}

.card-editor-search {
  margin: 0 0 12px;
  max-width: 360px;
}

.card-editor-search .editor-input {
  width: 100%;
}

.card-editor-table tr.is-hidden {
  display: none;
}

.card-editor-table tr.row-saved {
  animation: rowSavedFlash 1.2s ease;
}

.card-editor-table tr.row-error {
  animation: rowErrorFlash 1.2s ease;
}

@keyframes rowSavedFlash {
  0% {
    box-shadow: inset 0 0 0 2px #22c55e;
    background: #dcfce7;
  }
  100% {
    box-shadow: inset 0 0 0 0 transparent;
    background: transparent;
  }
}

@keyframes rowErrorFlash {
  0% {
    box-shadow: inset 0 0 0 2px #ef4444;
    background: #fee2e2;
  }
  100% {
    box-shadow: inset 0 0 0 0 transparent;
    background: transparent;
  }
}

.specials-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding: 6px 2px;
}

.specials-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-align: left;
}

.specials-name {
  font-weight: 700;
}

.specials-id {
  display: none;
}

.disc-specials {
  min-width: 160px;
  font-size: 12px;
  color: #374151;
}

.specials-apply-label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.specials-apply-label .editor-input.small {
  min-width: 180px;
}

.card-editor-th {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}

.info-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #111;
  background: #fff6d8;
  color: #111;
  font-size: 12px;
  line-height: 16px;
  font-family: "Press Start 2P", monospace;
  cursor: pointer;
  position: relative;
  padding: 0;
  flex-shrink: 0;
}

.info-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  max-width: 320px;
  white-space: normal;
  padding: 10px;
  border: 2px solid #111;
  background: #fff6d8;
  color: #111;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 3px 3px 0 #111;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  z-index: 5;
}

.card-editor-table th:first-child .info-btn::after {
  right: auto;
  left: 0;
}

.info-btn:hover::after,
.info-btn:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

#expand-info-btn::after {
  min-width: 320px;
  max-width: 560px;
  white-space: pre-wrap;
  text-align: left;
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  line-height: 1.45;
}

.card-editor-table .editor-input.small {
  font-size: 12px;
  padding: 4px 6px;
  min-height: 32px;
}

.card-editor-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.code-input {
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.expand-wrap {
  display: grid;
  gap: 6px;
}

.expand-card {
  width: min(90vw, 720px);
}

.expand-textarea {
  width: 100%;
  min-height: 240px;
}

.scorecard .under-par {
  background: #bbf7d0;
}


.badge {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  padding: 6px 8px;
  font-size: 20px;
  box-shadow: 2px 2px 0 var(--shadow);
}

.layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  --game-viewport-offset: 240px;
  align-items: start;
}

.left-col {
  display: grid;
  gap: 16px;
}

.board-wrap {
  background: var(--panel);
  border: 3px solid var(--panel-border);
  padding: 8px 16px 16px;
  box-shadow: 6px 6px 0 var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  margin: 0;
  max-height: calc(100vh - var(--game-viewport-offset));
  overflow: hidden;
}

.game-layout .board-wrap {
  height: calc(100vh - var(--game-viewport-offset));
  max-height: calc(100vh - var(--game-viewport-offset));
  align-items: stretch;
  min-height: 0;
  padding-bottom: 24px;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  width: 100%;
  flex-direction: column;
}

.course-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.course-title-row h2 {
  margin: 0;
}

.game-layout .board-header {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.board-distance {
  font-size: 14px;
  color: #111;
  padding: 4px 8px;
  border: 2px solid #111;
  background: #fff;
  box-shadow: 2px 2px 0 #111;
  white-space: nowrap;
}

.course-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.course-select-field {
  gap: 4px;
  margin: 0;
}

.course-controls .hint {
  margin: 0;
  font-size: 12px;
  color: #4b5563;
}

.course-controls .hint.is-error {
  color: #b91c1c;
}

.game-layout .course-controls {
  margin-left: auto;
}

.throw-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
  justify-content: flex-start;
}

.sandbox-throw-controls {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.throw-style {
  display: flex;
  gap: 6px;
  align-items: center;
}

.throw-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.throw-style .pixel-btn {
  padding: 6px 10px;
  font-size: 14px;
}

.throw-style .pixel-btn.is-active {
  background: #bbf7d0;
  border-color: #166534;
  color: #14532d;
}

.throw-controls .pixel-btn {
  padding: 10px 18px;
  font-size: 16px;
}

.throw-controls .dice-row {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  grid-template-columns: none;
}

.throw-controls .wind-readout {
  min-width: 44px;
  min-height: 28px;
  padding: 4px 6px;
  transform: none;
}

.dice-stack {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dice-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dice-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.throw-controls .info-popover {
  margin-left: 0;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.info-popover-inline {
  margin-top: 2px;
}

.info-popover {
  position: relative;
}

.info-popover summary {
  list-style: none;
}

.info-popover summary::-webkit-details-marker {
  display: none;
}

.info-marker {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid #111;
  background: #fff;
  color: #111;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  box-shadow: 2px 2px 0 #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.info-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--panel);
  border: 2px solid var(--panel-border);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.3;
  width: 220px;
  box-shadow: 4px 4px 0 var(--shadow);
  z-index: 3;
}

.terrain-info-popover .info-panel {
  left: 0;
  right: auto;
}

.hole-summary-card {
  width: min(520px, calc(100vw - 32px));
}

.hole-summary-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 16px;
}

.hole-summary-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 2px solid #111;
  background: #fff;
  padding: 8px 10px;
}

.hole-summary-rank {
  font-weight: 700;
}

.hole-summary-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hole-summary-hole,
.hole-summary-total {
  font-size: 12px;
}

h2, h3 {
  margin: 0 0 4px;
  font-size: 22px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.legend-item {
  font-size: 16px;
  padding: 4px 6px;
  border: 2px solid #111;
}

.legend-item.grass { background: var(--grass); }
.legend-item.fairway { background: var(--fairway); }
.legend-item.trees { background: var(--trees); }
.legend-item.bushes { background: var(--bushes); }
.legend-item.hazard {
  background: repeating-linear-gradient(
    45deg,
    var(--hazard) 0,
    var(--hazard) 8px,
    var(--hazard-dark) 8px,
    var(--hazard-dark) 16px
  );
}
.legend-item.oob {
  background: repeating-linear-gradient(
    45deg,
    var(--oob) 0,
    var(--oob) 8px,
    var(--oob-dark) 8px,
    var(--oob-dark) 16px
  );
}
.legend-item.water {
  background: repeating-linear-gradient(
    45deg,
    var(--water) 0,
    var(--water) 8px,
    var(--water-dark) 8px,
    var(--water-dark) 16px
  );
}
.legend-item.sand { background: var(--sand); }
.legend-item.tee {
  background: repeating-linear-gradient(
    0deg,
    var(--tee) 0,
    var(--tee) 8px,
    var(--tee-dark) 8px,
    var(--tee-dark) 16px
  );
}
.legend-item.basket {
  background:
    radial-gradient(circle at center, transparent 0 18%, var(--basket-ring-inner) 19% 31%, transparent 32% 100%),
    radial-gradient(circle at center, transparent 0 52%, var(--basket-ring) 53% 69%, transparent 70% 100%),
    repeating-linear-gradient(
      45deg,
      var(--basket) 0,
      var(--basket) 8px,
      var(--basket-dark) 8px,
      var(--basket-dark) 16px
    );
}

.board {
  --rows: 8;
  --cols: 12;
  --tile: 32px;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--tile));
  grid-auto-rows: var(--tile);
  column-gap: 2px;
  row-gap: 2px;
  justify-content: center;
  align-content: start;
  height: auto;
  width: auto;
  margin: 0 auto;
  max-height: 100%;
  max-width: 100%;
}

.tile {
  width: var(--tile);
  height: var(--tile);
  border: 2px solid #111;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.1);
  position: relative;
}

.tile span {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: clamp(8px, calc(var(--tile) * 0.18), 14px);
}

.tile.grass { background: var(--grass); }
.tile.fairway { background: var(--fairway); }
.tile.trees { background: var(--trees); }
.tile.bushes { background: var(--bushes); }
.tile.hazard {
  background: repeating-linear-gradient(
    45deg,
    var(--hazard) 0,
    var(--hazard) 8px,
    var(--hazard-dark) 8px,
    var(--hazard-dark) 16px
  );
}
.tile.oob {
  background: repeating-linear-gradient(
    45deg,
    var(--oob) 0,
    var(--oob) 8px,
    var(--oob-dark) 8px,
    var(--oob-dark) 16px
  );
}
.tile.water {
  background: repeating-linear-gradient(
    45deg,
    var(--water) 0,
    var(--water) 8px,
    var(--water-dark) 8px,
    var(--water-dark) 16px
  );
}
.tile.sand { background: var(--sand); }
.tile.tee {
  background: repeating-linear-gradient(
    0deg,
    var(--tee) 0,
    var(--tee) 8px,
    var(--tee-dark) 8px,
    var(--tee-dark) 16px
  );
}
.tile.basket {
  background:
    radial-gradient(circle at center, transparent 0 18%, var(--basket-ring-inner) 19% 31%, transparent 32% 100%),
    radial-gradient(circle at center, transparent 0 52%, var(--basket-ring) 53% 69%, transparent 70% 100%),
    repeating-linear-gradient(
      45deg,
      var(--basket) 0,
      var(--basket) 8px,
      var(--basket-dark) 8px,
      var(--basket-dark) 16px
    );
}

.tile .tile-icon {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: clamp(9px, calc(var(--tile) * 0.2), 18px);
  font-weight: 700;
  text-transform: uppercase;
}

.tile .token-stack {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(36px, calc(var(--tile) * 0.7), 70px);
  height: clamp(36px, calc(var(--tile) * 0.7), 70px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.tile .player-token {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(14px, calc(var(--tile) * 0.28), 28px);
  height: clamp(14px, calc(var(--tile) * 0.28), 28px);
  border: clamp(1px, calc(var(--tile) * 0.04), 2px) solid #111;
  box-shadow: clamp(1px, calc(var(--tile) * 0.04), 2px)
    clamp(1px, calc(var(--tile) * 0.04), 2px) 0 #111;
  background: #fff;
  transform: translate(-50%, -50%);
  transition: transform 180ms linear;
}


.tile.path {
  outline: 3px solid #111;
  box-shadow: inset 0 0 0 3px #fff;
}

.tile.ob {
  outline: 3px solid #ef4444;
  box-shadow: inset 0 0 0 3px #fee2e2;
}

.tile.blocked {
  outline: 3px solid #065f46;
  box-shadow: inset 0 0 0 3px #bbf7d0;
}

.tile.landing {
  outline: 3px solid #f59e0b;
  box-shadow: inset 0 0 0 3px #fef3c7;
  animation: landing-blink 1.2s ease-in-out 0s 3;
}

@keyframes landing-blink {
  0% {
    outline-color: #f59e0b;
    box-shadow: inset 0 0 0 3px #fef3c7;
  }
  50% {
    outline-color: #fde047;
    box-shadow: inset 0 0 0 3px #fff;
  }
  100% {
    outline-color: #f59e0b;
    box-shadow: inset 0 0 0 3px #fef3c7;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: #fff8e6;
  border: 3px solid var(--panel-border);
  padding: 8px 12px 12px;
  box-shadow: 6px 6px 0 var(--shadow);
}

.collapsible .collapsible-header {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 18px;
  padding: 0;
  margin-bottom: 8px;
  cursor: pointer;
}

.collapsible-body {
  display: none;
}

.collapsible-body.is-open {
  display: block;
}

.players-panel {
  padding-bottom: 10px;
}

.players-panel.full-row {
  width: 100%;
  margin-bottom: 12px;
}

.player-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.player-card {
  width: 100%;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 3px solid #111;
  background: #fff;
  box-shadow: 3px 3px 0 #111;
}

.player-card.is-active {
  outline: 3px solid var(--accent-2);
  box-shadow: 0 0 0 3px #111, 3px 3px 0 #111;
}

.player-card.is-inactive {
  opacity: 0.5;
  filter: grayscale(0.3);
}

.player-avatar {
  width: 40px;
  height: 40px;
  border: 3px solid #111;
  box-shadow: 2px 2px 0 #111;
  background: #e2e8f0;
}

.player-meta {
  display: grid;
  gap: 2px;
}

.player-name {
  font-size: 14px;
}

.player-sub {
  font-size: 12px;
  opacity: 0.8;
}

.player-conf {
  font-size: 12px;
}

.player-socials {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  min-width: 20px;
}

.player-social-link {
  color: #111;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.player-social-link svg {
  width: 18px;
  height: 18px;
  display: block;
}

.player-name-input {
  font-family: inherit;
  font-size: 14px;
  border: none;
  padding: 2px 0;
  width: 100%;
  background: #fff;
}

.panel-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
  gap: 8px;
}

.panel-actions.align-right {
  justify-content: flex-end;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header .panel-actions {
  margin-top: 0;
}

.collapsible-header {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.collapsible-header::after {
  content: '▾';
  font-size: 14px;
  transition: transform 0.2s ease;
}

.collapsible-header.is-open::after {
  transform: rotate(180deg);
}

.pile-status {
  display: flex;
  gap: 8px;
  margin: 8px 0;
  font-size: 16px;
}

.penalty-notice {
  font-size: 12px;
  margin: 8px 0 4px;
  min-height: 16px;
  color: #7c2d12;
}

.pile-chip {
  border: 2px solid #111;
  padding: 4px 6px;
  background: #fef3c7;
}

.card-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.card-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.disc-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.disc-card {
  background: #e9f5ff;
  border: 3px solid #111;
  padding: 8px;
  box-shadow: 3px 3px 0 #111;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.disc-card.is-active {
  outline: 3px solid var(--accent-2);
  box-shadow: 0 0 0 3px #111, 3px 3px 0 #111;
}

.disc-card.is-inactive {
  opacity: 0.5;
  filter: grayscale(0.3);
}

.disc-title {
  font-size: 18px;
}

.disc-type {
  font-size: 12px;
  opacity: 0.75;
}

.disc-image {
  width: 20px;
  height: 20px;
  border: 2px solid #111;
  background: var(--disc-color, #fef3c7);
  box-shadow: 2px 2px 0 #111;
  position: relative;
}

.disc-flight {
  font-size: 14px;
  background: #fff;
  border: 2px solid #111;
  padding: 4px 6px;
  text-align: center;
}

.disc-desc {
  font-size: 12px;
  min-height: 28px;
}

.disc-effect {
  font-size: 12px;
  background: #fef3c7;
  border: 2px solid #111;
  padding: 4px 6px;
}

.disc-meta {
  font-size: 12px;
  opacity: 0.8;
}

.loadout-panel .panel-title-row {
  align-items: flex-start;
}

.loadout-meta {
  margin-top: 4px;
}

.loadout-feedback {
  min-height: 18px;
  font-size: 12px;
  margin: 6px 0 2px;
  color: #14532d;
}

.loadout-feedback.is-error {
  color: #7f1d1d;
}

.loadout-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.loadout-item {
  border: 2px solid #111;
  background: #fff;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.loadout-item-meta {
  font-size: 12px;
  opacity: 0.8;
}

.loadout-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.loadout-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  min-width: 140px;
}

.loadout-field .editor-input {
  width: 100%;
  min-width: 140px;
}

.card {
  background: #ffe9b3;
  border: 3px solid #111;
  padding: 8px;
  box-shadow: 3px 3px 0 #111;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.card.is-inactive {
  opacity: 0.5;
  filter: grayscale(0.3);
}

.card-title {
  font-size: 18px;
}

.card-stat {
  font-size: 36px;
  text-align: right;
}

.dice-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  margin-top: 8px;
  align-items: center;
}

.die {
  width: 48px;
  height: 48px;
  border: 3px solid #111;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  box-shadow: 3px 3px 0 #111;
}

.wind-readout {
  text-align: center;
  font-size: 28px;
  font-weight: 700; 
  display: grid;
  place-items: center;
  gap: 6px;
  align-self: center;
  justify-self: center;
  transform: translate(-20px, -10px);
}

.wind-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.wind-arrow {
  font-size: 36px;
  line-height: 1;
}

.hint {
  font-size: 16px;
  margin: 8px 0 0;
}

.path-preview {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.path-preview span {
  font-size: 16px;
  padding: 4px 6px;
  border: 2px solid #111;
  background: #fef3c7;
}

.rules-list {
  margin: 8px 0 0;
  padding-left: 16px;
  font-size: 16px;
  line-height: 1.4;
}

.rules-list li {
  margin-bottom: 6px;
}

.special-card-field {
  margin-top: 8px;
  font-size: 12px;
}

.special-card-field .editor-input {
  width: 100%;
}

.sandbox-path {
  box-shadow: inset 0 0 0 2px #0ea5e9;
  background: rgba(14, 165, 233, 0.08);
}

.tile.path.sandbox-path {
  outline: 3px solid #111;
}

.penalty-log {
  display: grid;
  gap: 6px;
  font-size: 12px;
  max-height: calc(100vh - var(--game-viewport-offset) - 220px);
  overflow: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.penalty-entry {
  border: 2px solid #111;
  background: #fff;
  padding: 6px;
  box-shadow: 2px 2px 0 #111;
}

.penalty-entry.is-penalty-applied {
  border-color: #8b0000;
  background: #fff4cc;
  box-shadow: 2px 2px 0 #8b0000;
}

.penalty-entry.log-impact-positive {
  border-color: #0b5fff;
  background: #eef4ff;
  box-shadow: 2px 2px 0 #0b5fff;
}

.penalty-entry.log-impact-negative {
  border-color: #8b0000;
  background: #fff4cc;
  box-shadow: 2px 2px 0 #8b0000;
}

.log-body {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}

.log-spacer {
  height: 10px;
}

.log-player {
  font-weight: 700;
}

.log-sep {
  color: #111;
  opacity: 0.6;
}

.pixel-btn {
  font-family: inherit;
  font-size: 18px;
  padding: 8px 12px;
  border: 3px solid #111;
  background: #fde68a;
  box-shadow: 3px 3px 0 #111;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.pixel-btn.small {
  font-size: 12px;
  padding: 4px 10px;
}

.pixel-btn.alt {
  background: #bbf7d0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(246, 243, 231, 0.92);
  display: grid;
  place-items: center;
  z-index: 10;
}

.is-hidden {
  display: none !important;
}

.overlay.is-hidden {
  display: none;
}

.overlay-card {
  background: #fff8e6;
  border: 4px solid #111;
  padding: 20px;
  min-width: 280px;
  text-align: center;
  box-shadow: 8px 8px 0 #111;
}

.overlay-card {
  max-width: min(840px, 86vw);
  padding: 16px;
}

.welcome-card {
  text-align: left;
  max-width: min(640px, 92vw);
}

.welcome-card .hint {
  margin: 8px 0 0;
}

.welcome-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 14px;
  justify-content: flex-start;
  gap: 6px;
  text-align: left;
  width: 100%;
}

.welcome-row input[type='checkbox'] {
  margin: 0;
}

.feedback-card {
  text-align: left;
  min-width: min(520px, 92vw);
}

.feedback-text {
  min-height: 120px;
  resize: vertical;
}

.feedback-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.feedback-status {
  min-height: 20px;
}

.ace-fireworks {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  display: none;
  overflow: hidden;
}

.ace-fireworks.is-active {
  display: block;
}

.ace-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: hsl(var(--hue) 90% 60%);
  box-shadow: 0 0 10px hsl(var(--hue) 90% 60%);
  animation: ace-pop 1s ease-out forwards;
}

@keyframes ace-pop {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0.4);
    opacity: 0;
  }
}

.results-card {
  text-align: left;
}

.results-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.podium-card {
  border: 3px solid #111;
  background: #fff;
  padding: 8px;
  box-shadow: 3px 3px 0 #111;
}

.podium-rank {
  font-size: 12px;
  opacity: 0.7;
}

.results-table {
  margin: 8px 0 12px;
  display: grid;
  gap: 6px;
}

.results-row {
  border: 2px solid #111;
  background: #fef3c7;
  padding: 6px;
  font-size: 12px;
}

.results-card .rating-panel {
  margin-top: 12px;
}

.lobby-card {
  text-align: left;
}

.lobby-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 12px;
}

.lobby-row {
  border: 2px solid #111;
  background: #fef3c7;
  padding: 6px;
  font-size: 12px;
}
.disc-modal-card {
  text-align: left;
  min-width: min(720px, 92vw);
}

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

.disc-modal-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  max-height: min(60vh, 520px);
  overflow: auto;
  padding-right: 6px;
}

.disc-option {
  cursor: pointer;
}

.overlay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0 16px;
  font-size: 16px;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bag-disc-list {
  border: 2px solid #111;
  background: #fff;
  padding: 8px;
  max-height: 220px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bag-disc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.bag-disc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.bag-disc-table th,
.bag-disc-table td {
  border: 1px solid #111;
  padding: 4px 6px;
  vertical-align: top;
  background: #fff;
}

.bag-disc-table th {
  background: #fef3c7;
  text-align: left;
  position: sticky;
  top: 0;
}

.bag-disc-table tr.is-disallowed td {
  background: #fff1f2;
}

.bag-allowed.yes {
  color: #14532d;
  font-weight: 700;
}

.bag-allowed.no {
  color: #7f1d1d;
  font-weight: 700;
}

.overlay select {
  font-family: inherit;
  font-size: 16px;
  border: 3px solid #111;
  background: #fff;
  padding: 6px 10px;
}

.lobby-status-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
}

.status-pill.public {
  background: #bbf7d0;
  border-color: #166534;
  color: #14532d;
}

.status-pill.private {
  background: #fee2e2;
  border-color: #991b1b;
  color: #7f1d1d;
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .multiplayer-grid {
    grid-template-columns: 1fr;
  }

  .multiplayer-actions {
    justify-content: flex-start;
  }

}

@media (max-width: 1920px) and (max-height: 1080px) {
  #app {
    padding: 16px;
  }

  .layout {
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    height: calc(100vh - 200px);
  }

  .board {
    --tile: 28px;
    column-gap: 2px;
    row-gap: 2px;
  }

  .scorecard table {
    font-size: 12px;
  }
}


