/* ==========================================================================
   3D cellar — Components/Cellar3D/* (.c3-*) and the 3D setup (Pages/CellarSetup3D, .c3s-*)
   The scene is the app's three.js page in an iframe (wwwroot/cellar3d/scene.html); its own
   colours (#0f0d0c, the app's colors.cellarScene) live in that page. Desktop: the scene beside the
   panel; phone: the scene on top, the panel under it.
   ========================================================================== */
:root {
    --c3-scene: #0f0d0c;              /* app colors.cellarScene (the scene's own background) */
    --c3-scene-text: #d9cfc4;         /* app colors.cellarSceneText */
    --c3-glow: #66dda9;               /* the scene's mint slot glow */
}

.c3-panel { margin-top: 0.5rem; }
.c3-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(18rem, 1fr); gap: 1.75rem; align-items: start; }
.c3-stage { position: relative; position: sticky; top: 5.5rem; }

.c3-view {
    position: relative;
    height: min(72vh, 640px);
    min-height: 320px;
    border-radius: var(--radius-plinth);
    overflow: hidden;
    background: var(--c3-scene);
}
.c3-view--sk { animation: vbFade 0.4s ease both; }
.c3-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--c3-scene); }
.c3-overlay {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.875rem;
    padding: 1.5rem; text-align: center;
    background: var(--c3-scene); color: var(--c3-scene-text);
}
.c3-overlay p { margin: 0; font-size: 0.9375rem; }
.c3-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; }
.c3-bar::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 35%;
    background: var(--c3-glow); border-radius: 2px;
    animation: c3Slide 1.1s ease-in-out infinite;
}
@keyframes c3Slide { from { left: -35%; } to { left: 100%; } }
.c3-hint { position: absolute; left: 0; right: 0; bottom: 0.875rem; display: flex; justify-content: center; pointer-events: none; }
.c3-hint span {
    padding: 0.4rem 0.875rem; border-radius: 999px;
    background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 0.75rem; font-weight: 600;
    animation: vbFade 0.3s ease both;
}
.c3-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 3px 3px 0 0; overflow: hidden; pointer-events: none; }
.c3-progress::after { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: var(--c3-glow); animation: c3Slide 1.1s ease-in-out infinite; }

/* Placing a bottle: tap a glowing slot */
.c3-place {
    position: absolute; left: 0.75rem; right: 0.75rem; top: 0.75rem;
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.625rem 0.75rem 0.625rem 1rem; border-radius: 14px;
    background: var(--color-brand); color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.c3-place > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.c3-place b { font-size: 0.875rem; font-weight: 650; }
.c3-place span { font-size: 0.8125rem; color: #f5d98b; }
.c3-place button {
    flex: none; border: 0; border-radius: 999px; padding: 0.4rem 0.875rem;
    background: rgba(255, 255, 255, 0.16); color: #fff; font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}

/* The side panel */
.c3-side { display: flex; flex-direction: column; gap: 0.875rem; min-width: 0; }
.c3-stats { margin: 0; font-size: 0.8125rem; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.c3-notice { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--color-ok); }
/* .vb-search--compact grows along a row (flex: 1 1 26rem); in this column that would be its height. */
.c3-search { margin: 0; flex: none; max-width: none; }
.c3-arrange {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 0.875rem; border-radius: 14px;
    background: var(--color-wine-soft); color: var(--color-ink); font-size: 0.875rem;
}
.c3-arrange span { flex: 1; }
.c3-arrange button, .c3-place-btn {
    flex: none; border: 0; border-radius: 999px; padding: 0.4rem 0.875rem;
    background: var(--color-brand); color: #fff; font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
.c3-arrange button:disabled, .c3-place-btn:disabled { opacity: 0.5; cursor: default; }
.c3-rows { display: flex; flex-direction: column; max-height: 62vh; overflow: auto; margin-right: -0.25rem; padding-right: 0.25rem; }
.c3-row { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.625rem 0.25rem; border-bottom: 1px solid var(--color-line); }
.c3-row-main {
    display: flex; align-items: center; gap: 0.75rem; text-align: left;
    border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit;
}
.c3-row-main:hover b { color: var(--color-brand); }
.c3-row-bottle { width: 1.75rem; height: 2.75rem; flex: none; }
.c3-row-text { min-width: 0; display: flex; flex-direction: column; }
.c3-producer { font-size: 0.75rem; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c3-row-text b { font-size: 0.9375rem; font-weight: 650; color: var(--color-ink); line-height: 1.3; }
.c3-vintage { font-weight: 400; color: var(--color-body); }
.c3-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; padding-left: 2.5rem; }
.c3-chip {
    border: 0; border-radius: 7px; padding: 0.2rem 0.45rem;
    background: var(--color-brand-soft); color: var(--color-brand);
    font-family: Menlo, "DM Mono", ui-monospace, monospace; font-size: 0.75rem; cursor: pointer;
}
.c3-chip:hover { filter: brightness(0.95); }
.c3-chip--more { background: var(--color-stone); color: var(--color-muted); cursor: default; }
.c3-chip--loose { background: var(--color-wine-soft); color: var(--color-wine); font-family: var(--font-body); cursor: default; }
.c3-place-btn { margin-left: auto; }
.c3-muted { font-size: 0.8125rem; color: var(--color-muted); }
.c3-empty-list { text-align: center; padding: 1.5rem 0; }
.c3-edit { align-self: flex-start; font-size: 0.875rem; font-weight: 600; color: var(--color-brand); text-decoration: none; }
.c3-edit:hover { text-decoration: underline; }

/* The bottle you pulled out */
.c3-card { display: flex; flex-direction: column; gap: 1rem; }
.c3-back { align-self: flex-start; border: 0; background: none; padding: 0; font: inherit; font-size: 0.875rem; font-weight: 600; color: var(--color-brand); cursor: pointer; }
.c3-hero { display: flex; align-items: center; gap: 1rem; }
.c3-hero-bottle { width: 3.25rem; height: 5.25rem; flex: none; }
.c3-hero-text { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.c3-hero-text b { font-size: 1.1875rem; line-height: 1.25; font-weight: 650; color: var(--color-ink); }
.c3-hero-text span:last-child { font-size: 0.875rem; color: var(--color-body); }
.c3-eyebrow { font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); font-family: Menlo, "DM Mono", ui-monospace, monospace; }
.c3-address {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.875rem 1rem; border-radius: 16px; background: var(--color-stone);
}
.c3-address-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.c3-address code { font-family: Menlo, "DM Mono", ui-monospace, monospace; font-size: 1.375rem; font-weight: 600; color: var(--color-brand); }
.c3-address span { font-size: 0.875rem; color: var(--color-ink); }
.c3-minimap { flex: none; width: 6.5rem; max-height: 9rem; }
.c3-minimap circle { fill: var(--color-line); }
.c3-minimap circle.on { fill: var(--color-line-strong); }
.c3-minimap circle.me { fill: var(--color-wine); }
.c3-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.c3-act {
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--color-field); border-radius: 12px; background: var(--color-card-bg);
    padding: 0.7rem 0.75rem; font: inherit; font-size: 0.875rem; font-weight: 600; color: var(--color-brand);
    text-decoration: none; cursor: pointer;
}
.c3-act:hover { border-color: var(--color-line-strong); }
.c3-act:disabled { opacity: 0.5; cursor: default; }
.c3-act--primary { background: var(--color-brand); border-color: var(--color-brand); color: #fff; }
.c3-empty { padding: 3rem 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.c3-empty p { margin: 0; color: var(--color-body); }

/* ── Setup (Pages/CellarSetup3D) ── */
.c3s { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(20rem, 1fr); gap: 2rem; align-items: start; margin-top: 1.5rem; }
.c3s-preview { position: sticky; top: 5.5rem; }
.c3s-preview .c3-view { height: min(60vh, 520px); }
.c3s-preview--kind .c3-view { display: none; }
.c3s-form { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.c3s-dots { display: flex; gap: 0.4rem; }
.c3s-dots i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--color-line); }
.c3s-dots i.on { background: var(--color-brand); width: 1.25rem; border-radius: 999px; }
.c3s-title { margin: 0; font-size: 1.5rem; line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; color: var(--color-ink); }
.c3s-sub { margin: 0.35rem 0 0; font-size: 0.9375rem; line-height: 1.5; color: var(--color-body); }
.c3s-label { margin: 0 0 0.5rem; font-size: 0.8125rem; font-weight: 650; color: var(--color-muted); }
.c3s-cards { display: grid; gap: 0.625rem; }
.c3s-card {
    display: flex; flex-direction: column; gap: 0.2rem; text-align: left;
    padding: 0.875rem 1rem; border-radius: 16px; border: 1.5px solid var(--color-field); background: var(--color-card-bg);
    font: inherit; color: var(--color-ink); cursor: pointer;
}
.c3s-card b { font-size: 0.9375rem; font-weight: 650; }
.c3s-card span { font-size: 0.8125rem; color: var(--color-body); }
.c3s-card.is-on { border-color: var(--color-brand); background: var(--color-brand-soft); }
.c3s-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.c3s-rows { display: flex; flex-direction: column; border-top: 1px solid var(--color-line); }
.c3s-row { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--color-line); }
.c3s-row > div:not(.c3s-stepper) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.c3s-row b { font-size: 0.9375rem; font-weight: 600; color: var(--color-ink); }
.c3s-row span { font-size: 0.8125rem; color: var(--color-muted); }
.c3s-stepper { flex: none; display: inline-flex; flex-direction: row; align-items: center; gap: 0.25rem; }
.c3s-stepper button {
    width: 2.25rem; height: 2.25rem; border-radius: 50%;
    border: 1px solid var(--color-field); background: var(--color-card-bg);
    font: inherit; font-size: 1.125rem; line-height: 1; color: var(--color-ink); cursor: pointer;
}
.c3s-stepper button:disabled { opacity: 0.35; cursor: default; }
.c3s-stepper output { min-width: 2.25rem; text-align: center; font-size: 1rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.c3s-switch { position: relative; width: 2.75rem; height: 1.625rem; flex: none; }
.c3s-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.c3s-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--color-line-strong); transition: background 0.15s; pointer-events: none; }
.c3s-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.c3s-switch input:checked + span { background: var(--color-brand); }
.c3s-switch input:checked + span::after { transform: translateX(1.125rem); }
.c3s-switch input:focus-visible + span { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.c3s-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--color-stone); flex-wrap: wrap; }
.c3s-seg button { border: 0; background: none; padding: 0.45rem 1rem; border-radius: 999px; font: inherit; font-size: 0.875rem; font-weight: 600; color: var(--color-body); cursor: pointer; }
.c3s-seg button.is-on { background: var(--color-card-bg); color: var(--color-ink); box-shadow: 0 1px 3px rgba(16, 24, 43, 0.12); }
.c3s-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.c3s-chip { border: 1px solid var(--color-field); border-radius: 999px; padding: 0.35rem 0.8rem; background: var(--color-card-bg); font: inherit; font-size: 0.8125rem; cursor: pointer; }
.c3s-chip.is-on { border-color: var(--color-brand); background: var(--color-brand-soft); color: var(--color-brand); font-weight: 600; }
.c3s-sticker { border-radius: 8px; padding: 0.3rem 0.6rem; background: var(--color-stone); font-family: Menlo, "DM Mono", ui-monospace, monospace; font-size: 0.8125rem; }
.c3s-names { display: flex; flex-direction: column; gap: 0.5rem; }
.c3s-names label { display: flex; gap: 0.5rem; }
.c3s-names input { font: inherit; font-size: 0.9375rem; padding: 0.55rem 0.75rem; border: 1px solid var(--color-field); border-radius: 12px; background: var(--color-card-bg); color: var(--color-ink); min-width: 0; }
.c3s-names input.code { width: 3.5rem; text-align: center; text-transform: uppercase; }
.c3s-names input.name { flex: 1; }
.c3s-capacity { display: flex; justify-content: space-between; align-items: baseline; padding-top: 0.25rem; font-size: 0.875rem; color: var(--color-body); }
.c3s-capacity b { font-size: 1.125rem; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.c3s-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.c3s-stats div { padding: 0.875rem; border-radius: 14px; background: var(--color-stone); display: flex; flex-direction: column; }
.c3s-stats b { font-size: 1.5rem; font-variant-numeric: tabular-nums; color: var(--color-ink); }
.c3s-stats span { font-size: 0.75rem; color: var(--color-muted); }
.c3s-warn { padding: 0.875rem 1rem; border-radius: 14px; background: var(--color-wine-soft); color: var(--color-ink); font-size: 0.875rem; }
.c3s-warn b { display: block; margin-bottom: 0.2rem; }
.c3s-foot { display: flex; align-items: center; gap: 0.75rem; padding-top: 0.5rem; }
.c3s-foot .vb-btn { flex: 1; }
.c3s-remove { align-self: flex-start; border: 0; background: none; padding: 0; font: inherit; font-size: 0.875rem; font-weight: 600; color: var(--color-wine); cursor: pointer; }
.c3s-error { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--color-wine); }

@media (max-width: 900px) {
    .c3-layout, .c3s { grid-template-columns: minmax(0, 1fr); }
    .c3-stage, .c3s-preview { position: relative; top: 0; }
    .c3-view { height: 56vh; }
    .c3s-preview .c3-view { height: 38vh; }
    .c3-rows { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
    .c3-bar::after, .c3-progress::after { animation: none; left: 0; width: 100%; opacity: 0.5; }
}
