:root {
  color-scheme: light;
  --bg: #f7f8f3;
  --panel: #ffffff;
  --ink: #16231b;
  --muted: #647066;
  --line: #d9e1d5;
  --line-strong: #acbba8;
  --green: #1f7652;
  --green-deep: #10251b;
  --green-soft: #e6f3ec;
  --gold: #c6922f;
  --gold-soft: #fff4d8;
  --red: #c84f43;
  --blue: #3d739c;
  --shadow: 0 14px 34px rgba(29, 58, 39, 0.1);
  --logo-bar-height: 124px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: var(--app-height, 100vh);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(circle at top left, rgba(210, 231, 207, 0.9), transparent 360px),
    linear-gradient(180deg, #fbfcf8 0%, var(--bg) 42%, #eef5ec 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
  overscroll-behavior: none;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.app-logo-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: block;
  height: var(--logo-bar-height);
  padding: 0;
  background: #000;
  box-shadow: 0 8px 24px rgba(16, 37, 27, 0.24);
  overflow: hidden;
}

.logo-banner {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.logo-banner-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  background: #000;
  pointer-events: none;
  user-select: none;
}

.current-game-badge {
  position: absolute;
  right: 10px;
  bottom: 8px;
  display: grid;
  gap: 2px;
  min-width: 116px;
  max-width: min(46%, 190px);
  padding: 7px 10px;
  border: 1px solid rgba(255, 214, 113, 0.54);
  border-radius: 8px;
  background: rgba(11, 19, 14, 0.78);
  color: #f6e7b0;
  text-align: right;
  backdrop-filter: blur(4px);
}

.current-game-badge span {
  color: #9ea9a3;
  font-size: 10px;
  font-weight: 800;
}

.current-game-badge strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ffc226;
  font-size: 15px;
  font-weight: 900;
}

body.readonly-round .current-game-badge strong::after {
  content: " · 읽기";
}

.install-app-btn {
  position: absolute;
  left: 10px;
  bottom: 8px;
  min-height: 36px;
  border: 1px solid rgba(255, 214, 113, 0.54);
  border-radius: 8px;
  padding: 0 13px;
  background: rgba(11, 19, 14, 0.78);
  color: #ffc226;
  font-size: 13px;
  font-weight: 900;
  backdrop-filter: blur(4px);
}

.install-app-btn[hidden] {
  display: none;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 10, 7, 0.58);
}

.switch-dialog {
  width: min(360px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.switch-dialog h3,
.switch-dialog p {
  margin: 0;
}

.switch-dialog h3 {
  font-size: 18px;
}

.switch-dialog p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.dialog-actions .primary-btn {
  grid-column: 1 / -1;
}

.mobile-flow {
  position: sticky;
  top: var(--logo-bar-height);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 8px;
  background: var(--green-deep);
  box-shadow: 0 8px 24px rgba(16, 37, 27, 0.2);
}

.flow-btn {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d6e0d8;
  font-weight: 800;
  touch-action: manipulation;
}

.flow-btn.active {
  background: linear-gradient(180deg, #fbf6d8, #e6f0c8);
  color: var(--green-deep);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: default;
  opacity: 0.72;
}

body.readonly-round input,
body.readonly-round select {
  background: #f3f6f0;
  color: #26362d;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(var(--app-height, 100vh) - var(--logo-bar-height) - 60px);
  min-width: 0;
  max-width: 100%;
}

.sidebar {
  position: sticky;
  top: 0;
  height: var(--app-height, 100vh);
  padding: 22px;
  background: linear-gradient(180deg, #10251b, #173726);
  color: #f7fff9;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8dd83, #e6f0c8);
  color: var(--green-deep);
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-head h3,
.panel-title h2 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p,
.eyebrow {
  color: #aeb9b1;
  font-size: 13px;
}

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

.game-pill {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(230, 240, 200, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f7fff9;
  text-align: left;
  padding: 0 13px;
}

.game-pill.active {
  background: linear-gradient(180deg, #fbf6d8, #e6f0c8);
  color: var(--green-deep);
  border-color: #f8dd83;
  font-weight: 700;
}

.history-panel {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.panel-title,
.section-head,
.topbar,
.top-actions,
.legend,
.history-item {
  display: flex;
  align-items: center;
}

.score-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title,
.section-head,
.topbar {
  justify-content: space-between;
  gap: 14px;
}

.panel-title h2,
.section-head h3 {
  font-size: 17px;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-item {
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-align: left;
}

.history-open {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
}

.history-delete {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 16px;
}

.history-item small {
  display: block;
  color: #b6c0bb;
  margin-top: 3px;
}

.workspace {
  min-width: 0;
  max-width: 100%;
  padding: 20px;
}

.topbar {
  margin-bottom: 12px;
}

.topbar h2 {
  font-size: 30px;
  letter-spacing: 0;
}

.top-actions {
  gap: 8px;
}

.final-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.setup-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.setup-actions .primary-btn {
  min-width: min(260px, 100%);
}

.primary-btn,
.secondary-btn,
.icon-btn,
.segment {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
}

.primary-btn {
  background: linear-gradient(180deg, #26825b, var(--green));
  color: white;
  border-color: var(--green);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(31, 118, 82, 0.18);
}

.secondary-btn.small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.icon-btn {
  width: 36px;
  padding: 0;
}

.sidebar .icon-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.notice,
.control-grid,
.players-section,
.score-section,
.bonus-section,
.result-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.notice {
  padding: 10px 12px;
  margin-bottom: 10px;
  color: #6f4d0f;
  background: #fff7df;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(130px, 0.8fr) minmax(130px, 0.8fr) 96px 110px 110px;
  gap: 8px;
  padding: 10px;
}

.field {
  display: grid;
  gap: 4px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.player-name,
.score-input,
.par-select,
.bonus-select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fcfdfa;
  color: var(--ink);
  padding: 0 10px;
  font-size: 16px;
}

.action-field .secondary-btn {
  width: 100%;
}

.players-section,
.score-section,
.bonus-section,
.result-block {
  margin-top: 12px;
  padding: 12px;
  min-width: 0;
  max-width: 100%;
}

.score-section {
  overflow: hidden;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}

.segment {
  border: 0;
  border-radius: 0;
  background: #fcfdfa;
}

.segment.active {
  background: linear-gradient(180deg, #e6f3ec, #d5ebdf);
  color: var(--green-deep);
  font-weight: 900;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.legend {
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 5px;
}

.dot.par3 {
  background: var(--blue);
}

.dot.par5 {
  background: var(--gold);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  overflow-y: hidden;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  contain: inline-size;
}

.table-wrap.tall {
  max-height: 520px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.score-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 6px;
  text-align: center;
  white-space: nowrap;
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: 0;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: #edf4ec;
  color: #2c4335;
  font-size: 13px;
}

.score-table .course-header-row th {
  background: linear-gradient(180deg, #eaf3e7, #dfeade);
  color: #18221c;
  font-size: 14px;
  font-weight: 900;
  vertical-align: middle;
}

.score-table .course-group-head {
  min-height: 42px;
  padding: 10px 8px;
  text-align: center;
}

.score-table .name-corner-head,
.score-table .score-total-head {
  z-index: 2;
  text-align: center;
  vertical-align: middle;
}

.score-table .score-total-head,
.score-table .score-total {
  width: 64px;
  min-width: 64px;
}

.score-table .hole-header-row th {
  background: #f7f5e8;
  color: #18221c;
}

.score-table th:first-child,
.score-table td:first-child,
.result-table th:first-child,
.result-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fffef9;
  text-align: left;
}

.score-table th:first-child,
.score-table td:first-child {
  width: 74px;
  min-width: 74px;
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-table td:first-child {
  white-space: normal;
  word-break: break-all;
  line-height: 1.25;
  font-weight: 800;
}

.score-table .hole-header-row th,
.score-table tbody td:not(:first-child):not(.score-total) {
  width: 90px;
  min-width: 90px;
  max-width: 90px;
}

.score-table th:first-child,
.result-table th:first-child {
  background: #eef3ec;
}

.hole-head {
  display: grid;
  gap: 3px;
  min-width: 0;
  max-width: 78px;
  justify-items: center;
  margin: 0 auto;
}

.hole-title {
  color: #111;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
}

.par-inline {
  font-weight: 800;
}

.score-table .hole-head > .par-fixed {
  display: none;
}

.score-input {
  width: 32px;
  min-height: 30px;
  border-radius: 8px;
  text-align: center;
  padding: 0 2px;
  font-weight: 800;
}

.score-value-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
}

.heart-in-score {
  position: absolute;
  right: -5px;
  top: -7px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffe8ef;
  color: #d12b5b;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(209, 43, 91, 0.18);
  pointer-events: none;
}

.score-cell {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  width: 78px;
  max-width: 78px;
  margin: 0 auto;
}

.score-side-tags,
.score-below-tags {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  align-content: center;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
}

.score-below-tags {
  justify-content: center;
  margin-top: 3px;
  width: 78px;
  max-width: 78px;
  margin-left: auto;
  margin-right: auto;
  flex-wrap: nowrap;
  overflow: hidden;
}

.score-status-row {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
  width: 78px;
  max-width: 78px;
  min-height: 22px;
  margin: 3px auto 0;
  overflow: hidden;
}

.score-status-row:empty {
  display: none;
}

.score-status-row .oecd-strip:only-child {
  width: 100%;
}

.score-badge {
  display: inline-grid;
  place-items: center;
  width: fit-content;
  max-width: 40px;
  margin: 0;
  padding: 2px 5px;
  border-radius: 999px;
  background: #fff5df;
  color: #80540e;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  white-space: normal;
}

.oecd-strip {
  display: inline-grid;
  place-items: center;
  min-height: 22px;
  min-width: 0;
  padding: 1px 4px;
  border-radius: 3px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.oecd-strip.joined {
  background: #c00000;
}

.oecd-strip.released {
  background: #70ad47;
}

.oecd-badge {
  border: 1px solid transparent;
  color: #fff;
}

.oecd-badge.joined {
  background: #b3261e;
  border-color: #8b1d17;
}

.oecd-badge.released {
  background: #1f7a54;
  border-color: #176241;
}

.hussein-mark,
.hussein-select {
  display: inline-grid;
  place-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #161616;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.hussein-mark {
  min-width: 38px;
  padding: 0 5px;
}

.hussein-select {
  min-width: 48px;
  margin-top: 4px;
  border: 1px solid #161616;
}

.hussein-select.active {
  background: #ffc226;
  color: #161616;
}

.hussein-select.inline-choice {
  min-width: 38px;
  margin: 0;
  padding: 0 5px;
}

.score-rule-buttons {
  display: contents;
  gap: 2px;
  margin-top: 0;
}

.score-rule-btn {
  min-height: 21px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #a7b0a9;
  padding: 0 5px;
  font-size: 9px;
  line-height: 1;
}

.score-rule-btn.active {
  border-color: #edcc8a;
  background: #fff5df;
  color: #80540e;
  font-weight: 800;
}

.penalty-readonly {
  display: inline-grid;
  place-items: center;
  min-height: 22px;
  margin-top: 3px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #fdecea;
  color: #b3261e;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.1;
}

.par-select {
  min-height: 30px;
  padding: 0 4px;
  font-size: 12px;
}

.par-fixed {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f8faf7;
  color: #26362d;
  font-size: 12px;
  font-weight: 800;
}

.course-chip {
  display: block;
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.random-mode-chip {
  display: inline-grid;
  place-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #142019;
  color: #f7fff9;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.dice-control {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 3px;
  align-items: center;
  min-width: 78px;
}

.dice-control button,
.dice-control select {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 10px;
}

.dice-control span {
  grid-column: 1 / -1;
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
}

.team-select {
  display: none;
  width: 70px;
  min-height: 30px;
  margin: 4px auto 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  text-align: center;
}

.lr-inline-picker {
  display: inline-grid;
  grid-template-columns: repeat(2, 26px);
  gap: 3px;
  align-items: center;
}

.lr-inline-picker .team-mark {
  min-width: 26px;
  width: 26px;
  min-height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  opacity: 0.45;
}

.lr-inline-picker .team-mark.active {
  opacity: 1;
  border-width: 2px;
  box-shadow: 0 2px 6px rgba(35, 58, 43, 0.16);
}

.team-mark.single {
  min-width: 36px;
  width: 36px;
  border-width: 2px;
  opacity: 1;
}

.team-mark.lr-single {
  min-width: 38px;
  width: 38px;
  min-height: 30px;
  margin: 0;
  border: 1px solid var(--line-strong);
}

.team-mark.lr-single.empty {
  background: #f5f7f4;
  color: #7b8780;
}

.team-mark.lr-single.active {
  border-width: 2px;
  box-shadow: 0 2px 6px rgba(35, 58, 43, 0.16);
}

.penalty-selects {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 3px;
  margin-top: 0;
  align-items: center;
  justify-content: center;
  width: 75px;
  max-width: 75px;
  overflow: hidden;
}

.penalty-select {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  min-height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--red);
  font-size: 8px;
  text-align: center;
  padding: 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.draw-btn {
  min-height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.team-mark {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  min-height: 24px;
  margin-top: 0;
  border-radius: 999px;
  background: #eef3ec;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.team-mark.inline {
  min-width: 38px;
  max-width: 40px;
  margin-top: 0;
  padding: 0 5px;
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-mark.red {
  background: #ffe8e5;
  color: var(--red);
}

.team-mark.green {
  background: var(--green-soft);
  color: var(--green);
}

.team-mark.left {
  background: #e7f0ff;
  color: #2159a8;
}

.team-mark.right {
  background: #fff0dd;
  color: #9a5a12;
}

.team-mark.joker {
  background: #222;
  color: #fff;
}

.team-mark.joker-member {
  border: 1px solid #222;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.bonus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.bonus-card {
  display: grid;
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  font-size: 11px;
}

.bonus-card strong {
  font-size: 12px;
}

.bonus-select {
  min-height: 28px;
  padding: 0 5px;
  font-size: 11px;
}

.settlement-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.settlement-card {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.settlement-card strong {
  font-size: 14px;
}

.settlement-transfer-card {
  grid-column: 1 / -1;
}

.settlement-transfer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: #f7f5e8;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.settlement-transfer-row span {
  min-width: 0;
  white-space: normal;
  word-break: keep-all;
}

.settlement-transfer-row b {
  color: var(--green);
  white-space: nowrap;
}

.settlement-line {
  line-height: 1.35;
  font-size: 11px;
}

.settlement-line.receive {
  color: var(--green);
}

.settlement-line.pay {
  color: var(--red);
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
  gap: 10px;
}

body[data-step="game"] .app-shell,
body[data-step="setup"] .app-shell,
body[data-step="play"] .app-shell,
body[data-step="final"] .app-shell {
  grid-template-columns: 1fr;
}

body[data-step="game"] .workspace {
  display: none;
}

body[data-step="game"] .sidebar {
  position: relative;
  width: min(720px, 100%);
  height: auto;
  min-height: calc(var(--app-height, 100vh) - var(--logo-bar-height) - 60px);
  margin: 0 auto;
}

body[data-step="game"] .game-list {
  grid-template-columns: 1fr;
  gap: 10px;
}

body[data-step="game"] .game-pill {
  min-height: 56px;
  font-size: 17px;
}

body[data-step="setup"] .sidebar,
body[data-step="play"] .sidebar,
body[data-step="final"] .sidebar {
  display: none;
}

body[data-step="play"] [data-panel="setup"],
body[data-step="final"] [data-panel="setup"] {
  display: none !important;
}

body[data-step="setup"] .workspace,
body[data-step="play"] .workspace,
body[data-step="final"] .workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
}

body[data-step="final"] .results-grid {
  grid-template-columns: minmax(0, 1fr);
}

body[data-step="final"] .final-block {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.summary-pill {
  border-radius: 999px;
  background: #edf3ea;
  color: var(--green);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.money-plus {
  color: var(--green);
  font-weight: 800;
}

.cell-bonus {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-size: 10px;
  line-height: 1.15;
  font-weight: 700;
}

.money-minus {
  color: var(--red);
  font-weight: 800;
}

.payment-card-list-wrap {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.payment-balance-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.payment-balance-chip {
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  text-align: center;
}

.payment-balance-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.payment-balance-chip strong {
  font-size: 13px;
  white-space: nowrap;
}

.payment-card {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.payment-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

.payment-card-head strong {
  color: var(--ink);
  font-size: 14px;
}

.payment-card-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.payment-card-list {
  display: grid;
  gap: 5px;
}

.payment-card-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 5px 0;
  border-bottom: 1px dashed #dfe6dd;
}

.payment-card-item:last-child {
  border-bottom: 0;
}

.payment-card-item span {
  min-width: 0;
  white-space: normal;
  color: #26362d;
  font-size: 12px;
  font-weight: 800;
}

.payment-card-item small {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-size: 10px;
  line-height: 1.25;
}

.payment-card-item strong {
  font-size: 13px;
  white-space: nowrap;
}

.payment-empty {
  padding: 7px 0;
  color: #9aa59e;
  font-size: 12px;
  text-align: center;
}

.muted-cell {
  color: #a0aaa4;
}

.triggered {
  background: #fff5e0;
  color: #7a5312;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .control-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .bonus-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  :root {
    --logo-bar-height: 104px;
  }

  .app-logo-bar {
    padding: 0;
  }

  .logo-banner-media {
    object-position: 14% center;
  }

  .current-game-badge {
    right: 7px;
    bottom: 6px;
    min-width: 82px;
    max-width: 38%;
    padding: 4px 6px;
  }

  .current-game-badge span {
    font-size: 8px;
  }

  .current-game-badge strong {
    font-size: 12px;
  }

  .install-app-btn {
    left: 7px;
    bottom: 6px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .mobile-flow {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: calc(var(--app-height, 100vh) - var(--logo-bar-height));
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .workspace {
    padding: 12px;
  }

  .payment-block .table-wrap {
    overflow: visible;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-grid,
  .players-grid,
  .bonus-grid {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .segmented,
  .final-actions,
  .score-head-actions {
    width: 100%;
  }

  .primary-btn,
  .secondary-btn,
  .segment {
    flex: 1;
  }

  .score-head-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head h3,
  .topbar h2 {
    font-size: 22px;
  }

  .score-section,
  .players-section,
  .result-block {
    padding: 10px;
  }

  th,
  td {
    padding: 6px 5px;
  }

  .hole-head {
    min-width: 0;
    max-width: 76px;
    gap: 4px;
  }

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

  .random-mode-chip {
    min-height: 19px;
    padding: 2px 6px;
    font-size: 10px;
  }

  .score-input {
    width: 31px;
    min-height: 28px;
    font-size: 14px;
  }

  .score-value-wrap {
    width: 33px;
    min-width: 33px;
  }

  .score-cell {
    grid-template-columns: 33px minmax(0, 1fr);
    width: 76px;
    max-width: 76px;
    gap: 3px;
  }

  .score-status-row,
  .score-below-tags {
    width: 76px;
    max-width: 76px;
  }

  .course-chip {
    max-width: 76px;
    font-size: 9px;
  }

  .par-fixed {
    min-height: 24px;
    padding: 0 6px;
    font-size: 11px;
  }

  .score-badge {
    max-width: 54px;
    padding: 2px 5px;
    font-size: 9px;
  }

  .heart-in-score {
    right: -1px;
    bottom: -5px;
    width: 15px;
    height: 15px;
    font-size: 9px;
  }

  .team-mark {
    min-width: 36px;
    min-height: 24px;
    font-size: 10px;
  }

  .score-table th:first-child,
  .score-table td:first-child {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
  }

  .score-table .hole-header-row th,
  .score-table tbody td:not(:first-child):not(.score-total) {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
  }

  .payment-balance-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

.team-select,
.penalty-select {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
}

  .score-table td {
    background: #fff;
  }
}

@media (max-width: 430px) {
  :root {
    --logo-bar-height: 102px;
  }

  .logo-banner-media {
    object-position: 13% center;
  }
}
