.tarotScoreSheetApp {
    --score-ink: #241c17;
    --score-muted: #74675e;
    --score-paper: #fffdf8;
    --score-panel: #f6efe3;
    --score-line: #dfd1bd;
    --score-gold: #c8983e;
    --score-green: #2f7652;
    --score-green-dark: #20533a;
    --score-red: #a3453e;
    color: var(--score-ink);
    margin: 0 auto;
    max-width: 1180px;
    padding: 4px 0 30px;
}

.scoreSheetOfflineBody {
    background: #e9dfd0;
    margin: 0;
    padding: 20px;
}

.scoreSheetLoading {
    background: var(--score-paper);
    border: 1px solid var(--score-line);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
}

.scoreHero {
    align-items: center;
    background: linear-gradient(135deg, #2a211b 0%, #4e3829 68%, #6b4c31 100%);
    border-radius: 18px;
    box-shadow: 0 12px 34px rgba(39, 27, 20, .19);
    color: #fffaf0;
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    overflow: hidden;
    padding: 24px 28px;
    position: relative;
}

.scoreHero:after {
    border: 2px solid rgba(255,255,255,.12);
    border-radius: 50%;
    content: "21";
    font: 700 70px/128px Georgia, serif;
    height: 128px;
    position: absolute;
    right: 28px;
    text-align: center;
    top: -30px;
    transform: rotate(10deg);
    width: 128px;
}

.scoreHero h1 {
    color: inherit;
    font-family: Georgia, serif;
    font-size: 32px;
    margin: 0 0 6px;
    position: relative;
    z-index: 1;
}

.scoreHero p {
    color: #eadfce;
    margin: 0;
    max-width: 680px;
    position: relative;
    z-index: 1;
}

.scoreToolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 15px;
}

.scoreToolbar .btn {
    margin: 0;
}

.scoreToolbarSpacer {
    flex: 1 1 auto;
}

.scorePanel {
    background: var(--score-paper);
    border: 1px solid var(--score-line);
    border-radius: 15px;
    box-shadow: 0 4px 18px rgba(51, 37, 27, .08);
    margin-bottom: 16px;
    padding: 20px;
}

.scorePanel h2,
.scorePanel h3 {
    color: var(--score-ink);
    font-family: Georgia, serif;
    margin-top: 0;
}

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

.scorePanelHeader h2,
.scorePanelHeader h3 {
    margin-bottom: 0;
}

.scoreSetupIntro {
    color: var(--score-muted);
    margin-bottom: 18px;
}

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

.scoreFormGrid .scoreFieldWide {
    grid-column: 1 / -1;
}

.scoreField label,
.scoreField legend {
    color: #47372c;
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 5px;
}

.scoreField .form-control {
    height: 42px;
}

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

.scoreSetupActions,
.scoreFormActions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 18px;
}

.scoreStatus {
    border-radius: 10px;
    display: none;
    margin-bottom: 14px;
    padding: 11px 14px;
}

.scoreStatus.is-visible { display: block; }
.scoreStatus.is-success { background: #e3f3e9; color: #205a39; }
.scoreStatus.is-error { background: #f8e5e2; color: #842e27; }
.scoreStatus.is-info { background: #eee8dc; color: #514337; }

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

.scoreTotalCard {
    background: linear-gradient(180deg, #fff 0%, #f5eddf 100%);
    border: 1px solid var(--score-line);
    border-radius: 12px;
    min-width: 0;
    padding: 13px 10px;
    text-align: center;
}

.scoreTotalCard.is-leader {
    border-color: var(--score-gold);
    box-shadow: inset 0 3px 0 var(--score-gold);
}

.scoreTotalName {
    display: block;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scoreTotalValue {
    color: var(--score-green-dark);
    display: block;
    font: 700 25px/1.2 Georgia, serif;
    margin-top: 4px;
}

.scoreTotalValue.is-negative { color: var(--score-red); }

.scoreDealPreview {
    background: var(--score-panel);
    border-left: 4px solid var(--score-gold);
    border-radius: 8px;
    margin-top: 16px;
    padding: 13px 15px;
}

.scoreDealPreview.is-error {
    border-color: var(--score-red);
}

.scorePreviewTitle {
    font-weight: 700;
    margin-bottom: 6px;
}

.scorePreviewDeltas {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 8px;
}

.scoreDeltaPositive { color: var(--score-green-dark); font-weight: 700; }
.scoreDeltaNegative { color: var(--score-red); font-weight: 700; }

.scoreTableWrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.scoreHistoryTable {
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    min-width: 760px;
    width: 100%;
}

.scoreHistoryTable th,
.scoreHistoryTable td {
    border-bottom: 1px solid #eadfce;
    padding: 10px 8px;
    text-align: center;
    vertical-align: middle;
}

.scoreHistoryTable th {
    background: #f3ebdf;
    color: #4b3d32;
    font-size: 12px;
    position: sticky;
    top: 0;
}

.scoreHistoryTable td:first-child,
.scoreHistoryTable th:first-child {
    text-align: left;
}

.scoreHistoryMeta {
    color: var(--score-muted);
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.scoreRowActions {
    white-space: nowrap;
}

.scoreRowActions .btn {
    margin: 2px;
    padding: 4px 8px;
}

.scoreEmpty {
    color: var(--score-muted);
    padding: 24px 10px;
    text-align: center;
}

.scoreLibraryList {
    display: grid;
    gap: 9px;
}

.scoreLibraryItem {
    align-items: center;
    background: #faf5ec;
    border: 1px solid var(--score-line);
    border-radius: 10px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 11px 12px;
}

.scoreLibraryItemTitle {
    font-weight: 700;
}

.scoreLibraryItemMeta {
    color: var(--score-muted);
    display: block;
    font-size: 12px;
}

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

.scoreShareUrl input { min-width: 0; }

.scoreHint {
    color: var(--score-muted);
    font-size: 12px;
    margin-top: 6px;
}

.scoreSyncBadge {
    border-radius: 20px;
    display: inline-block;
    font-size: 12px;
    padding: 4px 9px;
}

.scoreSyncBadge.is-on { background: #dff1e5; color: #266344; }
.scoreSyncBadge.is-off { background: #ece7df; color: #6b6057; }
.scoreSyncBadge.is-dirty { background: #fff0cf; color: #765616; }

.scoreReadOnlyBanner {
    align-items: center;
    background: #f4ead5;
    border: 1px solid #ddc797;
    border-radius: 12px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 12px 14px;
}

.scoreDangerZone {
    border-top: 1px solid var(--score-line);
    margin-top: 18px;
    padding-top: 14px;
}

@media (max-width: 900px) {
    .scoreTotals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .scoreSheetOfflineBody { padding: 8px; }
    .tarotScoreSheetApp { padding-bottom: 18px; }
    .scoreHero { border-radius: 13px; padding: 19px 17px; }
    .scoreHero h1 { font-size: 26px; padding-right: 35px; }
    .scoreHero:after { font-size: 44px; height: 86px; line-height: 86px; right: -12px; top: -18px; width: 86px; }
    .scorePanel { border-radius: 12px; padding: 15px; }
    .scoreFormGrid,
    .scorePlayersSetup { grid-template-columns: 1fr; }
    .scoreTotals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .scoreToolbarSpacer { display: none; }
    .scoreToolbar .btn { flex: 1 1 auto; }
    .scorePanelHeader { align-items: flex-start; flex-direction: column; }
    .scoreShareUrl,
    .scoreReadOnlyBanner,
    .scoreLibraryItem { align-items: stretch; flex-direction: column; }
    .scoreFormActions .btn,
    .scoreSetupActions .btn { flex: 1 1 auto; }
}
