/* Casa Grande virtual bar */
:root {
    --cg-bg: #11090f;
    --cg-panel: rgba(31, 12, 26, .89);
    --cg-panel-strong: rgba(37, 14, 30, .97);
    --cg-border: rgba(174, 42, 91, .43);
    --cg-accent: #a82459;
    --cg-accent-2: #d65a82;
    --cg-gold: #e9bd7d;
    --cg-paper: #ead0b0;
    --cg-paper-ink: #2f1716;
    --cg-text: #f5e6d7;
    --cg-muted: #bda0a8;
    --cg-shadow: 0 16px 40px rgba(0, 0, 0, .38);
    --cg-radius: 14px;
    --cg-sidebar: 170px;
    --cg-rightbar: 280px;
    --cg-header: 112px;
    --cg-footer: 70px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--cg-bg); }
body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    color: var(--cg-text);
    background: #12090f;
    font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.cg-panel {
    border: 1px solid var(--cg-border);
    background: linear-gradient(145deg, rgba(49, 17, 38, .94), var(--cg-panel));
    box-shadow: var(--cg-shadow), inset 0 1px rgba(255, 255, 255, .035);
    backdrop-filter: blur(12px);
}
.cg-topbar {
    position: fixed; z-index: 50; inset: 0 0 auto 0;
    height: var(--cg-header);
    display: flex; align-items: center; padding: 18px 28px;
    pointer-events: none;
}
.cg-brand { pointer-events: auto; text-shadow: 0 3px 12px #000; }
.cg-brand__name {
    display: block; font: 700 clamp(36px, 4.1vw, 57px)/.9 Georgia, serif;
    font-style: italic; letter-spacing: -2px; color: #fff7ec;
}
.cg-brand__tagline {
    display: block; margin-top: 9px; color: #df3e72;
    font-weight: 800; letter-spacing: 4px;
}
.cg-mobile-menu {
    display: none; margin-left: auto; pointer-events: auto;
    width: 44px; height: 44px; border: 1px solid var(--cg-border);
    border-radius: 10px; background: var(--cg-panel-strong);
}
.cg-sidebar {
    position: fixed; z-index: 40; top: var(--cg-header); bottom: calc(var(--cg-footer) + 10px); left: 18px;
    width: var(--cg-sidebar); overflow: auto; border-radius: var(--cg-radius);
}
.cg-nav { display: grid; }
.cg-nav__item {
    display: grid; grid-template-columns: 26px 1fr; gap: 7px; align-items: center;
    min-height: 49px; padding: 0 14px; border-bottom: 1px solid rgba(255,255,255,.05);
    color: #eee0db; font-weight: 650;
}
.cg-nav__item span { color: var(--cg-gold); font-size: 18px; text-align: center; }
.cg-nav__item:hover, .cg-nav__item.is-active {
    background: linear-gradient(90deg, rgba(159, 25, 76, .62), rgba(109, 16, 54, .25));
}
.cg-profile, .cg-season-note { margin: 14px; padding: 13px; border: 1px solid var(--cg-border); border-radius: 12px; background: rgba(15,7,13,.45); }
.cg-profile h2, .cg-season-note h2, .cg-widget h2 {
    margin: 0 0 12px; color: var(--cg-gold); font-size: 14px; text-transform: uppercase; letter-spacing: .5px;
}
.cg-profile__row { display: flex; gap: 10px; align-items: center; }
.cg-profile__row img { border-radius: 50%; border: 2px solid #8f2853; }
.cg-profile__row strong, .cg-profile__row span, .cg-profile__row small { display: block; }
.cg-profile__row span { color: var(--cg-muted); font-size: 12px; }
.cg-profile__row small { color: var(--cg-gold); }
.cg-link-button {
    padding: 8px 0 0; border: 0; background: none; color: #dfc2b7; text-decoration: underline; cursor: pointer;
}
.cg-season-note {
    background: linear-gradient(rgba(43,20,18,.78), rgba(30,13,15,.9)), url("/assets/images/paper-texture.svg");
}
.cg-season-note p { margin: 0; color: #ddc4ad; font: italic 14px Georgia, serif; }

.cg-stage {
    position: relative; min-height: 100vh; min-height: 100dvh;
    display: grid; grid-template-columns: minmax(0, 1fr) var(--cg-rightbar); gap: 10px;
    padding: 18px 18px calc(var(--cg-footer) + 20px) calc(var(--cg-sidebar) + 28px);
}
.cg-scene {
    position: relative;
    min-height: calc(100vh - var(--cg-footer) - 38px);
    min-height: calc(100dvh - var(--cg-footer) - 38px);
    overflow: hidden;
    border-radius: 0;

    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;

    background-image: var(--cg-wallpaper, url("/assets/images/scene-bar-night.webp"));
}
.cg-scene__shade {
    position: absolute; inset: 0; pointer-events: none;
    background:
      linear-gradient(90deg, rgba(12,5,10,.38), transparent 20%, transparent 77%, rgba(12,5,10,.25)),
      linear-gradient(0deg, rgba(10,4,8,.66), transparent 34%);
}
.cg-dialogue {
    position: absolute; z-index: 2; left: 20px; right: 20px;
    bottom: calc(var(--cg-footer) + 10px);
    max-width: 760px; margin-inline: auto; padding: 18px 24px 14px;
    max-height: calc(100dvh - var(--cg-header) - var(--cg-footer) - 58px);
    overflow-y: auto;
    display: flex; flex-direction: column;
    color: var(--cg-text);
    border-color: var(--cg-border); border-radius: 8px;
    background: linear-gradient(rgba(22,10,17,.55), rgba(17,7,13,.62));
    backdrop-filter: blur(6px);
}
.cg-dialogue::before, .cg-dialogue::after {
    content: ""; position: absolute; inset: 7px; border: 1px solid rgba(233,189,125,.2); pointer-events: none;
}
.cg-dialogue::after { inset: 11px; border-style: dashed; opacity: .35; }
.cg-message {
    position: relative; z-index: 1; display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 13px;
    padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.08);
    flex: 0 0 auto;
}
.cg-message img { border-radius: 50%; }
.cg-message p { margin: 3px 0; }
.cg-message__meta { display: flex; justify-content: space-between; gap: 15px; }
.cg-message__meta time { color: var(--cg-muted); }
.cg-typing { display: flex; gap: 4px; margin-top: 5px; }
.cg-typing i { width: 7px; height: 7px; border-radius: 50%; background: #7b2350; animation: cg-dot 1.1s infinite; }
.cg-typing i:nth-child(2) { animation-delay: .16s; }
.cg-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes cg-dot { 50% { transform: translateY(-3px); opacity: .55; } }

.cg-composer {
    position: sticky; bottom: 0; z-index: 3; flex: 0 0 auto;
    display: grid; grid-template-columns: 44px 1fr 46px; gap: 8px;
    align-items: center; margin-top: 10px; padding-top: 10px;
    background: linear-gradient(rgba(17,7,13,.75), rgba(17,7,13,.92) 30%);
}
.cg-composer input {
    width: 100%; height: 46px; padding: 0 17px; border: 2px solid rgba(233,189,125,.28);
    border-radius: 24px; outline: 0; color: var(--cg-text); background: rgba(0,0,0,.28);
}
.cg-composer input::placeholder { color: var(--cg-muted); }
.cg-composer input:focus { border-color: #d65a82; box-shadow: 0 0 0 3px rgba(214,90,130,.18); }
.cg-icon-button, .cg-send {
    width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
}
.cg-icon-button { border: 2px solid rgba(233,189,125,.28); background: transparent; color: var(--cg-gold); }
.cg-send { border: 0; background: #8c1f52; color: white; font-size: 25px; }

.cg-rightbar {
    position: relative; z-index: 5; display: grid; align-content: start; gap: 10px; padding-top: 5px;
}
.cg-widget { overflow: hidden; border-radius: var(--cg-radius); }
.cg-widget__heading {
    display: flex; justify-content: space-between; align-items: center;
    min-height: 48px; padding: 0 15px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.cg-widget__heading h2 { margin: 0; }
.cg-widget__heading button { border: 0; background: none; cursor: pointer; }
.cg-news { padding: 6px 12px; }
.cg-news__item {
    display: grid; grid-template-columns: 40px 1fr; gap: 9px; padding: 9px 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.cg-news__item time, .cg-dialog-list time { color: #c2a69d; font-size: 11px; }
.cg-news__item span { color: #db4777; font-size: 11px; font-weight: 800; }
.cg-news__item p { margin: 3px 0 0; font-size: 12px; }
.cg-widget__action {
    display: block; margin: 8px 12px 12px; padding: 7px 12px; border-radius: 16px;
    background: rgba(144,27,72,.65); text-align: center; font-size: 12px;
}
.cg-model dl { margin: 0; padding: 10px 15px 2px; }
.cg-model dl div { display: flex; justify-content: space-between; padding: 6px 0; }
.cg-model dt { color: #d7af84; }
.cg-model dd { margin: 0; }
.cg-dialog-list { display: grid; padding: 5px 12px; }
.cg-dialog-list a {
    display: grid; grid-template-columns: 42px 1fr; gap: 7px; padding: 7px 0;
    border-bottom: 1px solid rgba(255,255,255,.05); font-size: 11px;
}

.cg-footer {
    position: fixed; z-index: 60; inset: auto 18px 8px 18px; height: var(--cg-footer);
    display: grid; grid-template-columns: 260px 1fr 340px; align-items: center;
    border-radius: 12px; overflow: hidden;
}
.cg-footer__status, .cg-player { display: flex; align-items: center; gap: 12px; padding: 0 18px; }
.cg-footer__status small, .cg-player small { display: block; color: var(--cg-muted); }
.cg-footer nav { display: flex; justify-content: center; height: 100%; }
.cg-footer nav a { display: flex; align-items: center; padding: 0 24px; border-inline: 1px solid rgba(255,255,255,.04); color: var(--cg-gold); }
.cg-player { justify-content: flex-end; }
.cg-player button { border: 0; background: none; cursor: pointer; }

.cg-profile-modal {
    position: fixed; z-index: 100; inset: 0; display: grid; place-items: center;
    padding: 20px; background: rgba(4,2,4,.72);
}
.cg-profile-modal[hidden] { display: none; }
.cg-profile-form { width: min(420px, 100%); padding: 24px; border-radius: 14px; }
.cg-profile-form label { display: block; margin-bottom: 6px; color: var(--cg-muted); }
.cg-profile-form input {
    width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--cg-border);
    border-radius: 8px; background: rgba(0,0,0,.25); color: white;
}
.cg-profile-form > div { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.cg-button { padding: 9px 18px; border: 1px solid #b23967; border-radius: 8px; background: #8d204f; cursor: pointer; }
.cg-button--ghost { background: transparent; }

body[data-time-theme="morning"] { --cg-accent: #b94b63; }
body[data-time-theme="day"] { --cg-accent: #c54666; }
body[data-time-theme="evening"] { --cg-accent: #a82459; }
body[data-time-theme="night"] { --cg-accent: #78204d; }

@media (max-width: 1180px) {
    :root { --cg-sidebar: 150px; --cg-rightbar: 240px; }
    .cg-brand__name { font-size: 39px; }
    .cg-dialogue { max-width: 680px; }
    .cg-footer { grid-template-columns: 210px 1fr 280px; }
    .cg-footer nav a { padding-inline: 12px; }
}
@media (max-width: 920px) {
    :root { --cg-header: 78px; --cg-footer: 62px; }
    .cg-topbar { height: var(--cg-header); padding: 12px 16px; }
    .cg-brand__name { font-size: 31px; }
    .cg-brand__tagline { font-size: 10px; margin-top: 5px; }
    .cg-mobile-menu { display: block; }
    .cg-sidebar { transform: translateX(-115%); transition: transform .2s ease; top: 82px; width: 260px; }
    body.is-menu-open .cg-sidebar { transform: translateX(0); }
    .cg-stage { grid-template-columns: 1fr; padding: 0 0 calc(var(--cg-footer) + 8px); }
    .cg-scene { min-height: 100vh; min-height: 100dvh; }
    .cg-rightbar { display: none; }
    .cg-dialogue { left: 10px; right: 10px; bottom: calc(var(--cg-footer) + 8px); padding: 14px; }
    .cg-footer { inset-inline: 8px; grid-template-columns: 1fr auto; }
    .cg-footer nav { display: none; }
    .cg-player { padding-inline: 10px; }
}
@media (max-width: 600px) {
    .cg-message { grid-template-columns: 38px 1fr; gap: 9px; font-size: 13px; }
    .cg-message img { width: 38px; height: 38px; }
    .cg-message:nth-of-type(2) { display: none; }
    .cg-dialogue { bottom: calc(var(--cg-footer) + 4px); }
    .cg-footer__status { padding-inline: 10px; font-size: 12px; }
    .cg-player div { display: none; }
}
