@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Grotesk:wght@700&family=IBM+Plex+Mono:wght@500;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --paper: #F1ECDE;
    --paper-raised: #FBF8EF;
    --ink: #2B2A28;
    --ink-soft: #6B675F;
    --line: rgba(43, 42, 40, 0.14);

    --red: #C0392B;
    --red-soft: #F4D9D4;
    --yellow: #D69E2E;
    --yellow-soft: #F6E7C4;
    --green: #3F8A5D;
    --green-soft: #D7E9DB;
    --blue: #2F6690;
    --blue-soft: #D6E3EC;

    --radius: 10px;
    --shadow: 0 2px 0 rgba(43,42,40,0.08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    padding-bottom: 40px;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px 0;
}

/* Header / masthead */
.masthead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 2px;
    padding: 6px 2px 14px;
    border-bottom: 3px solid var(--ink);
    margin-bottom: 16px;
}
.masthead h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 19px;
    letter-spacing: 0.3px;
    margin: 0;
    line-height: 1.2;
}
.masthead .sub {
    font-size: 12px;
    color: var(--ink-soft);
    font-family: 'IBM Plex Mono', monospace;
}

/* Player strip */
.player-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.player-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px 6px 8px;
    font-size: 13px;
    font-weight: 600;
}
.player-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ink-soft);
}
.player-chip.active {
    border-color: var(--ink);
    background: #FFF9E6;
}
.player-chip.active .dot {
    background: var(--yellow);
    box-shadow: 0 0 0 3px var(--yellow-soft);
}
.player-chip .pen {
    font-family: 'IBM Plex Mono', monospace;
    color: var(--red);
    font-size: 11px;
}

/* Cards */
.card {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.card h2 {
    font-family: 'Archivo Black', sans-serif;
    font-size: 16px;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.card p { line-height: 1.5; }
.hint { color: var(--ink-soft); font-size: 13px; }

/* Buttons */
button {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    cursor: pointer;
    transition: transform 0.06s ease;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
    background: var(--ink);
    color: var(--paper-raised);
    width: 100%;
}
.btn-secondary {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--ink);
}
.btn-skip {
    background: transparent;
    color: var(--ink-soft);
    border: 1.5px dashed var(--line);
    width: 100%;
    margin-top: 8px;
}
.btn-skip-urgent {
    background: var(--red);
    color: white;
    border: 1.5px solid var(--red);
    animation: skip-pulse 1.4s ease-in-out infinite;
}
@keyframes skip-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.45); }
    50% { box-shadow: 0 0 0 7px rgba(192, 57, 43, 0); }
}

.no-options-banner {
    background: var(--red-soft);
    color: var(--red);
    border: 1.5px solid var(--red);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    margin-top: 12px;
}

input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    margin-bottom: 10px;
    background: var(--paper);
    color: var(--ink);
}
input[type="text"]:focus {
    outline: none;
    border-color: var(--ink);
}

/* Dice row */
.dice-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 14px 0 6px;
    flex-wrap: wrap;
}
.die {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 19px;
    color: white;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18);
}
.die.white { background: #FFFFFF; color: var(--ink); border: 2px solid var(--ink); }
.die.red { background: var(--red); }
.die.yellow { background: var(--yellow); }
.die.green { background: var(--green); }
.die.blue { background: var(--blue); }

.roller-name {
    text-align: center;
    font-size: 13px;
    color: var(--ink-soft);
    margin-bottom: 4px;
}

/* Board */
.board { margin-top: 4px; }
.row-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.row-label {
    width: 14px;
    height: 28px;
    border-radius: 4px;
}
.row-label.red { background: var(--red); }
.row-label.yellow { background: var(--yellow); }
.row-label.green { background: var(--green); }
.row-label.blue { background: var(--blue); }

.row-cells {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 3px;
    flex: 1;
}
.cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.cell.red-tone { background: var(--red-soft); }
.cell.yellow-tone { background: var(--yellow-soft); }
.cell.green-tone { background: var(--green-soft); }
.cell.blue-tone { background: var(--blue-soft); }

.cell.crossed { color: var(--ink); }
.cell.crossed::after,
.cell.crossed::before {
    content: '';
    position: absolute;
    width: 130%;
    height: 2.5px;
    background: var(--ink);
    top: 50%;
    left: -15%;
}
.cell.crossed::after { transform: rotate(28deg); }
.cell.crossed::before { transform: rotate(-28deg); }

.cell.candidate {
    outline: 2.5px solid var(--ink);
    outline-offset: -2.5px;
    cursor: pointer;
    color: var(--ink);
    font-weight: 700;
}
.cell.candidate:active { background: var(--ink); color: var(--paper-raised); }

.cell.locked-cell {
    background: var(--ink);
    color: var(--paper-raised);
}
.cell.locked-cell.crossed::after,
.cell.locked-cell.crossed::before {
    background: var(--paper-raised);
}

.cell.has-lock .num { pointer-events: none; }
.lock-badge {
    position: absolute;
    bottom: 0px;
    right: 1px;
    font-size: 7px;
    line-height: 1;
    pointer-events: none;
}

.row-count {
    width: 20px;
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--ink-soft);
}

.penalty-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.penalty-boxes { display: flex; gap: 5px; }
.penalty-box {
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--red);
    border-radius: 4px;
}
.penalty-box.filled { background: var(--red); }

/* Scoreboard (end of game) */
.score-table { width: 100%; border-collapse: collapse; font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.score-table th, .score-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.score-table th:not(:first-child), .score-table td:not(:first-child) { text-align: right; }
.score-table tr:first-child td { font-weight: 700; }
.rank-1 { color: var(--green); }

.section-title {
    font-family: 'IBM Plex Mono', monospace;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--ink-soft);
    margin: 22px 0 8px;
}

.error-banner {
    background: var(--red-soft);
    color: var(--red);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* Raumliste */
.room-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}
.room-item-name {
    font-weight: 700;
    font-size: 14px;
}
.room-item-meta {
    font-size: 12px;
    color: var(--ink-soft);
    font-family: 'IBM Plex Mono', monospace;
}
.room-item-btn {
    padding: 8px 14px;
    white-space: nowrap;
}
.room-item.disabled {
    opacity: 0.55;
}
.room-item.disabled .room-item-btn {
    border-color: var(--ink-soft);
    color: var(--ink-soft);
}

/* Teilen-Leiste */
.share-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 8px 8px 12px;
    margin-bottom: 16px;
}
.share-url {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.share-btn {
    background: var(--green);
    color: white;
    font-size: 13px;
    padding: 8px 14px;
    flex-shrink: 0;
}

/* Raum-Aktionen (verlassen / abbrechen) */
.room-actions {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin: -8px 0 18px;
}
.link-btn {
    background: transparent;
    border: none;
    padding: 4px 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.link-btn.danger { color: var(--red); }

@media (max-width: 360px) {
    .die { width: 38px; height: 38px; font-size: 16px; }
    .cell { font-size: 9px; }
}
