.hc-toolbar { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 2.5rem; border-bottom: 1px solid var(--ui-line); }
.hc-toolbar__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; }
.hc-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.1rem; }
.hc-settings .ui-select { min-height: 40px; }
.hc-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hc-import { display: flex; flex-direction: column; gap: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--ui-line); }
.hc-flash { color: #0f8a4f; font-weight: 800; }

.hc-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); padding: 1.25rem 2.5rem 1.75rem; }
.hc-boards { align-self: start; }
.hc-editor { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.hc-preview-panel { min-width: 0; }
.hc-panel { padding: 0.9rem 1rem; border: 1px solid var(--ui-edge); border-radius: 12px; background: #fff; }
.hc-panel__title { margin: 0 0 0.6rem !important; color: var(--ui-ink); font-size: 0.95rem; font-weight: 800; }
.hc-panel__title span { color: var(--ui-muted); font-weight: 700; }
.hc-stack { display: flex; flex-direction: column; gap: 0.75rem; }
.hc-short { min-height: 4.5rem; }
.hc-lead { max-width: 20rem; }
.hc-dds { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.hc-help { margin: 0; color: var(--ui-muted); font-size: 0.8rem; font-weight: 600; line-height: 1.45; }
.hc-status { min-height: 1.2em; margin-top: 0.6rem; font-size: 0.85rem; font-weight: 700; line-height: 1.6; }
.hc-err { color: #b4233a; }
.hc-note { color: var(--ui-muted); }
.hc-ok { color: #0f6a40; }
.hc-status .s-S,
.hc-board-list .s-S { color: #1d4ed8; }
.hc-status .s-H,
.hc-board-list .s-H { color: #d12b3a; }
.hc-status .s-D,
.hc-board-list .s-D { color: #e07000; }
.hc-status .s-C,
.hc-board-list .s-C { color: #0f7a45; }

@media (min-width: 1024px) {
    .hc-layout { grid-template-columns: 210px minmax(0, 1fr); }
    .hc-preview-panel { grid-column: 2; }
}

@media (min-width: 1280px) {
    .hc-layout { grid-template-columns: 200px minmax(0, 1.05fr) minmax(0, 1fr); }
    .hc-preview-panel { grid-column: 3; }
    .hc-preview-sticky { position: sticky; top: 1rem; }
}

.hc-preview-sticky { background: var(--ui-soft); }

.hc-board-list { display: flex; flex-direction: column; gap: 0.35rem; max-height: 60vh; overflow-y: auto; }
.hc-board-item { display: flex; align-items: stretch; border: 1px solid var(--ui-edge); border-radius: 10px; background: #fff; }
.hc-board-item.active { border-color: var(--ui-focus); background: #f1f7ff; }
.hc-board-select { flex: 1; min-width: 0; padding: 0.45rem 0.6rem; border: 0; background: none; color: var(--ui-ink); font: inherit; text-align: left; cursor: pointer; }
.hc-board-top { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.hc-board-num { font-size: 0.86rem; font-weight: 800; }
.hc-board-status { color: var(--ui-faint); font-size: 0.72rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.hc-board-status.ok { color: #0f8a4f; }
.hc-board-status.bad { color: #b4233a; }
.hc-board-sub { display: block; overflow: hidden; color: var(--ui-muted); font-size: 0.74rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.hc-board-actions { display: grid; grid-template-columns: repeat(2, 1.6rem); align-content: center; padding-right: 0.25rem; }
.hc-board-actions button { height: 1.6rem; border: 0; border-radius: 6px; background: none; color: var(--ui-muted); font: inherit; font-size: 0.78rem; cursor: pointer; }
.hc-board-actions button:hover:not(:disabled) { background: var(--ui-soft); color: var(--ui-ink); }
.hc-board-actions button:disabled { opacity: 0.3; cursor: default; }
.hc-add { width: 100%; margin-top: 0.75rem; }

.hc-compass {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "center" "n" "e" "s" "w" "tools" "help";
    gap: 0.6rem;
}

@media (min-width: 640px) {
    .hc-compass {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-areas: "help n tools" "w center e" ". s .";
    }
}

.hc-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.45rem;
    grid-area: center;
    padding: 0.6rem;
    border: 1.5px dashed var(--ui-edge);
    border-radius: 12px;
    background: var(--ui-zebra);
}
.hc-center .ui-field { gap: 0.2rem; }
.hc-center .ui-field__label { font-size: 0.74rem; }
.hc-center .ui-input,
.hc-center .ui-select { min-height: 40px; }
.hc-tools { display: flex; flex-direction: column; gap: 0.4rem; grid-area: tools; }
.hc-tools .ui-btn { min-height: 38px; font-size: 0.84rem; }
.hc-compass > .hc-help { grid-area: help; }
.hc-seat-N { grid-area: n; }
.hc-seat-E { grid-area: e; }
.hc-seat-S { grid-area: s; }
.hc-seat-W { grid-area: w; }
.hc-seat { padding: 0.5rem 0.6rem; border: 1px solid var(--ui-edge); border-radius: 12px; background: var(--ui-soft); transition: opacity 0.2s; }
.hc-seat.is-hidden { opacity: 0.5; }
.hc-seat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0.4rem; margin-bottom: 0.3rem; font-size: 0.82rem; }
.hc-seat-name { color: var(--ui-ink); font-weight: 800; }
.hc-seat-meta { color: var(--ui-muted); font-size: 0.74rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hc-seat-meta.is-full { color: #0f8a4f; }
.hc-seat-meta.is-over { color: #b4233a; }
.hc-eye { display: inline-flex; align-items: center; gap: 0.25rem; margin-left: auto; color: var(--ui-muted); font-size: 0.72rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.hc-eye input { accent-color: var(--ui-focus); }
.hc-suit-row { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.25rem; }
.hc-suit { flex: 0 0 1.1rem; margin: 0; font-size: 1.05rem; line-height: 1; text-align: center; }
.hc-cards {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 0.5rem;
    border: 1.5px solid var(--ui-edge);
    border-radius: 8px;
    background: #fff;
    color: var(--ui-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.06em;
}
.hc-cards:focus { border-color: var(--ui-focus); outline: none; box-shadow: var(--ui-ring); }
.hc-cards.is-dup { border-color: #f1a7b3; background: #fff0f3; }

@media (max-width: 719.98px) {
    .hc-toolbar { padding: 1rem 1.15rem; }
    .hc-layout { padding: 1rem 1.15rem 1.25rem; }
    .hc-actions { width: 100%; }
    .hc-actions .ui-btn { flex: 1 1 calc(50% - 0.25rem); }
}

.paper {
    background: #fff;
    color: #111827;
    border-radius: 0.5rem;
    padding: 14px 16px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 10pt;
    overflow-x: auto;
}

.paper .s-S,
.paper .s-C {
    color: #111827;
}

.paper .s-H,
.paper .s-D {
    color: #dc2626;
}

.paper.four-color .s-D {
    color: #ea580c;
}

.paper.four-color .s-C {
    color: #15803d;
}

.pc-doc-head {
    text-align: center;
    margin-bottom: 5mm;
    padding-bottom: 3mm;
    border-bottom: 0.4mm solid #111827;
}

.pc-doc-head h1 {
    font-size: 17pt;
    font-weight: 700;
    margin: 0;
}

.pc-doc-head p {
    font-size: 10.5pt;
    color: #4b5563;
    margin: 1mm 0 0;
}

.pc-board {
    padding: 3mm 0 5mm;
    border-bottom: 0.3mm solid #d1d5db;
    break-inside: avoid;
    page-break-inside: avoid;
}

.pc-board:last-child {
    border-bottom: 0;
}

.pc-board.page-break {
    break-after: page;
    page-break-after: always;
    border-bottom: 0;
}

.pc-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 5mm 8mm;
}

.pc-diagram {
    display: grid;
    grid-template-columns: minmax(26mm, max-content) minmax(24mm, max-content) minmax(26mm, max-content);
    column-gap: 3mm;
    row-gap: 2mm;
    align-items: center;
}

.pc-info {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    font-size: 8.5pt;
    line-height: 1.4;
    color: #374151;
}

.pc-info-board {
    font-size: 11pt;
    font-weight: 700;
    color: #111827;
}

.pc-n {
    grid-column: 2;
    grid-row: 1;
}

.pc-w {
    grid-column: 1;
    grid-row: 2;
}

.pc-c {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
}

.pc-e {
    grid-column: 3;
    grid-row: 2;
}

.pc-s {
    grid-column: 2;
    grid-row: 3;
}

.pc-extra {
    grid-column: 1;
    grid-row: 3;
    align-self: end;
    font-size: 8.5pt;
    line-height: 1.5;
}

.pc-suit-line {
    white-space: nowrap;
    font-size: 10.5pt;
    line-height: 1.4;
}

.pc-suit {
    display: inline-block;
    width: 4.4mm;
    font-size: 11pt;
}

.pc-compass {
    position: relative;
    width: 22mm;
    height: 22mm;
    border: 0.4mm solid #1f2937;
    background: #fff;
}

.pc-cmp {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7.5pt;
    font-weight: 700;
    background: #e5e7eb;
    color: #111827;
}

.pc-cmp.is-vul {
    background: #dc2626;
    color: #fff;
}

.pc-cmp.is-dealer {
    text-decoration: underline;
    text-underline-offset: 1px;
}

.pc-cmp-n {
    top: 0;
    left: 0;
    right: 0;
    height: 4.5mm;
}

.pc-cmp-s {
    bottom: 0;
    left: 0;
    right: 0;
    height: 4.5mm;
}

.pc-cmp-w {
    left: 0;
    top: 4.5mm;
    bottom: 4.5mm;
    width: 4.5mm;
}

.pc-cmp-e {
    right: 0;
    top: 4.5mm;
    bottom: 4.5mm;
    width: 4.5mm;
}

.pc-cmp-center {
    position: absolute;
    inset: 4.5mm;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11pt;
    font-weight: 700;
}

.pc-cmp-center.hcp {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    font-size: 7pt;
    font-weight: 600;
    text-align: center;
    align-items: center;
}

.pc-hcp-n {
    grid-column: 2;
    grid-row: 1;
}

.pc-hcp-w {
    grid-column: 1;
    grid-row: 2;
}

.pc-hcp-e {
    grid-column: 3;
    grid-row: 2;
}

.pc-hcp-s {
    grid-column: 2;
    grid-row: 3;
}

.pc-side {
    display: flex;
    flex-direction: column;
    gap: 3mm;
}

.pc-auction {
    border-collapse: collapse;
    font-size: 9.5pt;
}

.pc-auction th {
    font-weight: 700;
    padding: 0.6mm 2.5mm;
    border-bottom: 0.3mm solid #111827;
    min-width: 11mm;
    text-align: center;
}

.pc-auction th.is-vul {
    color: #dc2626;
}

.pc-auction td {
    padding: 0.6mm 2.5mm;
    text-align: center;
    white-space: nowrap;
}

.pc-q {
    font-weight: 800;
    color: #2563eb;
}

.pc-dds {
    border-collapse: collapse;
    font-size: 8.5pt;
}

.pc-dds caption {
    font-size: 8pt;
    font-weight: 600;
    text-align: left;
    margin-bottom: 1mm;
    color: #374151;
}

.pc-dds th,
.pc-dds td {
    border: 0.2mm solid #d1d5db;
    padding: 0.4mm 1.8mm;
    text-align: center;
}

.pc-notes {
    margin-top: 3mm;
    font-size: 10pt;
    line-height: 1.5;
}

.pc-notes p,
.pc-solution p {
    margin: 0 0 2mm;
}

.pc-notes p:last-child,
.pc-solution p:last-child {
    margin-bottom: 0;
}

.pc-solution {
    margin-top: 2.5mm;
    padding: 2mm 3mm;
    border-left: 0.8mm solid #2563eb;
    background: #f8fafc;
    font-size: 10pt;
    line-height: 1.5;
}

.pc-solution-title {
    font-weight: 700;
    font-size: 8.5pt;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1e3a8a;
    margin-bottom: 1mm;
}

.paper { box-shadow: 0 1px 3px rgba(20, 23, 43, 0.12); }

#printRoot { display: none; }

@page {
    size: A4;
    margin: 14mm;
}

@media print {
    html,
    body,
    .ui-body { background: #fff !important; }

    .ui-body::before,
    .ui-body::after { display: none !important; }

    body > *:not(#printRoot) { display: none !important; }

    #printRoot { display: block; }

    .paper-print {
        padding: 0;
        border-radius: 0;
        overflow: visible;
        box-shadow: none;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
