:root {
  color-scheme: light;
  --ink: #181a1f;
  --muted: #70747e;
  --line: #e2e4e9;
  --soft: #f5f6f8;
  --paper: #ffffff;
  --sidebar: #17191d;
  --blue: #356ee8;
  --blue-soft: #eaf0ff;
  --coral: #e64f47;
  --coral-soft: #fff0ef;
  --green: #21875b;
  --amber: #b96c10;
  --radius: 7px;
  --shadow: 0 12px 36px rgba(25, 29, 40, .11);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--soft); font-size: 16px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .56; }
.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; }
[hidden] { display: none !important; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #202228; }
.login-screen::before { content: ""; position: fixed; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 42px 42px; pointer-events: none; }
.login-panel { position: relative; width: min(100%, 390px); padding: 38px; background: var(--paper); border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.login-panel h1 { margin: 8px 0; font-size: 1.75rem; }
.login-copy { margin: 0 0 28px; color: var(--muted); line-height: 1.6; }
.login-panel label, .dialog-card label { display: grid; gap: 8px; color: #454952; font-size: .875rem; font-weight: 700; }
.password-field { display: grid; grid-template-columns: 1fr 44px; margin: 8px 0 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.password-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.password-field input { min-width: 0; padding: 11px 13px; border: 0; outline: 0; background: transparent; }

.brand-mark { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; gap: 3px; background: #25282e; border-radius: 6px; }
.brand-mark span { display: block; width: 4px; border-radius: 3px; background: white; }
.brand-mark span:nth-child(1) { height: 16px; background: #ff695e; }
.brand-mark span:nth-child(2) { height: 11px; }
.brand-mark span:nth-child(3) { height: 21px; background: #5b8cff; }
.brand-mark.large { width: 48px; height: 48px; margin-bottom: 24px; }
.brand-mark.large span { width: 5px; }

.eyebrow { margin: 0; color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px 16px; color: #f7f7f8; background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 28px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; }
.brand small { margin-top: 1px; color: #9ea2ad; font-size: .75rem; }
.nav-list { display: grid; gap: 4px; }
.nav-item { width: 100%; height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: 6px; color: #aeb1ba; background: transparent; text-align: left; font-weight: 650; }
.nav-item svg { width: 19px; }
.nav-item:hover { color: white; background: #25282e; }
.nav-item.active { color: white; background: #2d3138; }
.nav-item.active::before { content: ""; width: 3px; height: 20px; margin-left: -12px; border-radius: 2px; background: #ff695e; }
.nav-item.active svg { margin-left: -3px; }
.sidebar-foot { margin-top: auto; min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 6px 0 12px; border-top: 1px solid #30333a; color: #b5b8c0; font-size: .8125rem; }
.sidebar-foot .icon-button { margin-left: auto; }

.main { min-width: 0; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 17px clamp(20px, 4vw, 48px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.topbar h1 { margin: 3px 0 0; font-size: 1.55rem; }
.topbar-actions { display: flex; align-items: end; gap: 9px; }
.room-picker { display: grid; gap: 4px; }
.room-picker span { color: var(--muted); font-size: .75rem; font-weight: 700; }
select, input, textarea { color: var(--ink); border: 1px solid var(--line); border-radius: 6px; background: white; outline: none; }
select { width: min(340px, 36vw); height: 40px; padding: 0 34px 0 11px; }
input { height: 42px; padding: 0 12px; }
textarea { width: 100%; padding: 11px 12px; resize: vertical; line-height: 1.55; }
select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.content { padding: 28px clamp(20px, 4vw, 48px) 48px; }
.view { display: none; }
.view.active { display: block; animation: appear .18s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(3px); } }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-head h2 { margin: 3px 0 0; font-size: 1.05rem; }
.status-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.status-item { min-height: 70px; display: flex; align-items: center; gap: 11px; padding: 14px 18px; border-right: 1px solid var(--line); }
.status-item:last-child { border-right: 0; }
.status-item small, .status-item strong { display: block; }
.status-item small { color: var(--muted); font-size: .75rem; }
.status-item strong { margin-top: 3px; font-size: .9rem; }
.status-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(33,135,91,.13); }
.status-dot.bad { background: var(--coral); box-shadow: 0 0 0 3px rgba(230,79,71,.13); }
.status-dot.muted { background: #adb0b8; box-shadow: none; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.summary-grid article { min-width: 0; display: grid; grid-template-columns: 38px 1fr auto; grid-template-rows: 22px 30px; align-items: center; padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.summary-grid svg { grid-row: 1 / 3; width: 21px; color: var(--blue); }
.summary-grid span { color: var(--muted); font-size: .78rem; font-weight: 700; }
.summary-grid strong { align-self: end; font-size: 1.45rem; line-height: 1; }
.summary-grid small { align-self: end; color: var(--muted); font-size: .75rem; }

.dashboard-operators { margin-bottom: 18px; padding: 18px 22px; }
.dashboard-operator-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-top: 14px; border-top: 1px solid var(--line); }
.dashboard-operator { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 14px 16px 14px 0; }
.dashboard-operator + .dashboard-operator { padding-left: 16px; border-left: 1px solid var(--line); }
.dashboard-operator svg { width: 20px; color: var(--blue); }
.dashboard-operator strong, .dashboard-operator small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-operator small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.dashboard-operator .operator-role { grid-column: auto; grid-row: auto; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.voice-panel, .screen-panel { padding: 22px; }
.state-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 999px; color: var(--muted); background: var(--soft); font-size: .75rem; font-weight: 800; }
.state-pill span { width: 7px; height: 7px; border-radius: 50%; background: #a8abb3; }
.state-pill.active { color: var(--green); background: #e9f6ef; }
.state-pill.active span { background: var(--green); }
.voice-stage { min-height: 250px; display: flex; align-items: center; justify-content: center; gap: 22px; padding: 28px; }
.voice-stage strong { display: block; margin-bottom: 8px; font-size: 1.25rem; }
.voice-stage p { max-width: 390px; margin: 0; color: var(--muted); line-height: 1.6; }
.voice-glyph { width: 88px; height: 88px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--blue); background: var(--blue-soft); }
.voice-glyph svg { width: 38px; height: 38px; }
.button-row { display: flex; gap: 9px; padding-top: 18px; border-top: 1px solid var(--line); }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid transparent; border-radius: 6px; font-weight: 750; }
.button svg { width: 17px; height: 17px; }
.button.primary { color: white; background: var(--blue); }
.button.primary:hover { background: #285fda; }
.button.danger { color: var(--coral); border-color: #f0bbb7; background: var(--coral-soft); }
.button.danger:hover { background: #ffe4e1; }
.button.subtle { color: #333740; border-color: var(--line); background: white; }
.button.ghost { border-color: transparent; background: transparent; }
.button.wide { width: 100%; }
.operation-result { min-height: 21px; margin-top: 12px; color: var(--muted); font-size: .82rem; }
.operation-result.success { color: var(--green); }
.operation-result.error { color: var(--coral); }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--ink); background: var(--soft); }
.icon-button svg { width: 18px; height: 18px; }
.icon-button.bordered { border: 1px solid var(--line); background: white; }
.icon-button.inverse:hover { color: white; background: #2c2f35; }

.phone-frame { width: min(100%, 284px); aspect-ratio: 9 / 16; margin: 22px auto 0; overflow: hidden; border: 8px solid #22252a; border-radius: 24px; background: #111; box-shadow: var(--shadow); }
.phone-frame img { width: 100%; height: 100%; display: block; object-fit: contain; background: #111; }
.section-tools { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-caption { margin: 0; color: var(--muted); }
.search-field { width: min(470px, 100%); position: relative; }
.search-field svg { position: absolute; left: 12px; top: 12px; width: 18px; color: var(--muted); }
.search-field input { width: 100%; padding-left: 40px; }
.count-label { color: var(--muted); font-size: .875rem; }
.inline-actions { display: flex; align-items: center; gap: 12px; }

.history-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 150px 140px auto auto; gap: 9px; margin-bottom: 12px; }
.history-toolbar select { width: 100%; }
.history-summary { display: flex; justify-content: space-between; margin: 0 2px 10px; color: var(--muted); font-size: .78rem; }
.history-panel { height: min(720px, calc(100vh - 245px)); min-height: 500px; display: flex; flex-direction: column; overflow: hidden; background: #b7c8d6; }
.chat-room-bar { min-height: 62px; display: flex; align-items: center; gap: 11px; flex: 0 0 auto; padding: 10px 16px; border-bottom: 1px solid #d9dde2; background: white; }
.chat-room-bar strong, .chat-room-bar small { display: block; }
.chat-room-bar strong { max-width: min(62vw, 620px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.chat-room-bar small { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.chat-room-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: white; background: #657d90; }
.chat-room-icon svg { width: 19px; }
.history-list { flex: 1 1 auto; overflow-y: auto; padding: 20px clamp(14px, 3vw, 34px) 28px; scroll-behavior: smooth; }
.history-panel > .empty-state { flex: 1; min-height: 0; background: #b7c8d6; }
.chat-date-divider { display: flex; justify-content: center; margin: 4px 0 18px; }
.chat-date-divider span, .chat-system-content { color: white; background: rgba(65, 82, 96, .58); font-size: .71rem; }
.chat-date-divider span { padding: 5px 10px; border-radius: 8px; }
.chat-message { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 14px; }
.chat-message.mine { justify-content: flex-end; }
.history-avatar { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #4a6478; background: #edf3f7; border: 1px solid rgba(50, 70, 85, .12); font-size: .78rem; font-weight: 850; }
.chat-message-body { min-width: 0; max-width: min(74%, 690px); display: flex; flex-direction: column; align-items: flex-start; }
.chat-message.mine .chat-message-body { align-items: flex-end; }
.chat-sender { margin: 0 0 5px 2px; color: #28333c; font-size: .76rem; font-weight: 750; }
.chat-bubble-line { display: flex; align-items: flex-end; gap: 6px; min-width: 0; max-width: 100%; }
.chat-message.mine .chat-bubble-line { flex-direction: row-reverse; }
.chat-bubble { min-width: 34px; max-width: 100%; padding: 9px 11px; border-radius: 3px 7px 7px; color: #202329; background: white; box-shadow: 0 1px 2px rgba(36, 53, 65, .14); }
.chat-message.mine .chat-bubble { border-radius: 7px 3px 7px 7px; background: #fee500; }
.chat-message.flagged .chat-bubble { box-shadow: inset 0 0 0 1px rgba(190, 58, 50, .34), 0 1px 2px rgba(36, 53, 65, .14); }
.chat-time { flex: 0 0 auto; padding-bottom: 1px; color: #455967; font-size: .65rem; white-space: nowrap; }
.chat-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.chat-message.mine .chat-meta { justify-content: flex-end; }
.history-badge { padding: 2px 5px; border-radius: 4px; color: #56616a; background: rgba(232, 236, 239, .9); font-size: .62rem; font-weight: 800; }
.chat-message.mine .history-badge:not(.deleted):not(.hidden) { background: rgba(191, 170, 0, .18); }
.history-badge.deleted, .history-badge.hidden { color: #b63e38; background: #fff0ef; }
.history-message { margin: 0; line-height: 1.48; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-message.placeholder { color: #687078; font-size: .82rem; }
.history-media { display: grid; grid-template-columns: repeat(2, minmax(110px, 210px)); gap: 6px; margin-top: 8px; }
.history-media:only-child { margin-top: 0; }
.history-media a { min-width: 0; }
.history-media img, .history-media video { width: 100%; max-height: 290px; display: block; border: 0; border-radius: 5px; object-fit: cover; background: #111; }
.history-media audio { width: min(320px, 100%); }
.history-file { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid rgba(40, 51, 60, .18); border-radius: 5px; color: var(--ink); background: rgba(255, 255, 255, .45); text-decoration: none; overflow-wrap: anywhere; }
.history-file:hover { border-color: var(--blue); color: var(--blue); }
.history-file svg { width: 17px; flex: 0 0 auto; }
.history-raw { margin-top: 8px; color: #5d6871; font-size: .7rem; }
.history-raw summary { cursor: pointer; font-weight: 700; }
.history-raw pre { max-width: min(560px, 64vw); max-height: 240px; overflow: auto; margin: 7px 0 0; padding: 10px; border-radius: 5px; color: #cfd3db; background: #1d2025; font: 11px/1.55 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-system-row { display: flex; justify-content: center; margin: 10px 0 18px; text-align: center; }
.chat-system-content { max-width: min(84%, 620px); padding: 6px 11px; border-radius: 8px; line-height: 1.45; }
.chat-system-content .history-badge { margin-left: 4px; vertical-align: 1px; }
.chat-system-content time { margin-left: 5px; opacity: .86; font-size: .64rem; white-space: nowrap; }
.chat-system-content .history-raw { color: white; text-align: left; }
.history-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }

.photo-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 150px auto; gap: 9px; margin-bottom: 12px; }
.photo-toolbar .search-field { width: 100%; }
.photo-toolbar select { width: 100%; }
.photo-summary { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 10px; color: var(--muted); font-size: .78rem; }
.photo-summary > div { display: flex; align-items: center; gap: 10px; }
.photo-actions { justify-content: flex-end; }
.photo-actions .button { min-height: 36px; padding-inline: 11px; font-size: .76rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 13px; }
.photo-item { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.photo-item.flagged { border-color: #eab3af; }
.photo-item.selected { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
.photo-select { position: absolute; z-index: 2; top: 8px; left: 8px; cursor: pointer; }
.photo-select input { position: absolute; opacity: 0; pointer-events: none; }
.photo-select span { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .82); border-radius: 6px; color: transparent; background: rgba(24, 26, 31, .58); box-shadow: 0 1px 5px rgba(0, 0, 0, .18); }
.photo-select input:checked + span { color: white; border-color: var(--blue); background: var(--blue); }
.photo-select input:focus-visible + span { outline: 3px solid var(--blue-soft); }
.photo-select svg { width: 16px; }
.photo-thumbnail { position: relative; width: 100%; display: block; aspect-ratio: 1 / 1; padding: 0; overflow: hidden; border: 0; color: white; background: #e8eaee; }
.photo-thumbnail img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .18s ease; }
.photo-thumbnail:hover img { transform: scale(1.025); }
.photo-open { position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: rgba(24, 26, 31, .72); opacity: 0; transition: opacity .16s ease; }
.photo-thumbnail:hover .photo-open, .photo-thumbnail:focus-visible .photo-open { opacity: 1; }
.photo-open svg { width: 15px; }
.photo-info { min-height: 58px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 9px 10px; }
.photo-info > div { min-width: 0; display: flex; align-items: center; gap: 5px; }
.photo-info strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.photo-info time { color: var(--muted); font-size: .67rem; white-space: nowrap; }
.photo-dialog { width: min(920px, calc(100vw - 32px)); height: min(900px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px); overflow: hidden; }
.photo-dialog-card { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 14px; padding: 18px; }
.photo-preview { min-height: 0; display: grid; place-items: center; overflow: hidden; background: #17191d; }
.photo-preview img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; display: block; object-fit: contain; }
.photo-dialog-footer { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.photo-dialog-footer > span { min-width: 0; overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }

.room-identity { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 22px; margin-bottom: 18px; }
.room-identity h2 { margin: 5px 0 4px; font-size: 1.2rem; }
.room-identity p:last-child { margin: 0; color: var(--muted); font: .78rem/1.5 "SFMono-Regular", Consolas, monospace; }
.room-facts { display: grid; grid-template-columns: repeat(4, minmax(88px, 1fr)); }
.room-facts div { min-width: 100px; padding: 2px 18px; border-left: 1px solid var(--line); }
.room-facts span, .room-facts strong { display: block; }
.room-facts span { color: var(--muted); font-size: .75rem; }
.room-facts strong { margin-top: 5px; font-size: 1rem; }
.room-management-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; align-items: start; }
.room-settings, .room-admin-panel { padding: 22px; }
.toggle-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin-top: 18px; border-top: 1px solid var(--line); }
.toggle-row { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle-row span, .toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { margin-top: 3px; color: var(--muted); font-size: .75rem; font-weight: 400; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row > i { position: relative; width: 40px; height: 22px; flex: 0 0 auto; border-radius: 12px; background: #c7cad1; transition: background .16s ease; }
.toggle-row > i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .16s ease; }
.toggle-row input:checked + i { background: var(--blue); }
.toggle-row input:checked + i::after { transform: translateX(18px); }
.toggle-row input:focus-visible + i { outline: 3px solid var(--blue-soft); }
.game-settings { margin-top: 22px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: opacity .16s ease; }
.game-settings.disabled { opacity: .5; }
.game-settings-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.game-settings-head strong, .game-settings-head small { display: block; }
.game-settings-head strong { font-size: .9rem; }
.game-settings-head small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.game-settings-head svg { width: 20px; color: var(--coral); }
.game-settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.game-settings-grid label { display: grid; gap: 6px; color: #454952; font-size: .78rem; font-weight: 700; }
.game-settings-grid input { width: 100%; }
.game-settings-grid small { color: var(--muted); font-size: .68rem; font-weight: 400; }
.horse-roster { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.horse-roster span { color: var(--muted); font-size: .7rem; font-weight: 800; }
.horse-roster p { margin: 6px 0 0; color: #4e535c; font-size: .76rem; line-height: 1.65; }
.game-status-panel { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 22px; margin-bottom: 18px; }
.game-status-copy { display: flex; align-items: center; gap: 18px; }
.game-status-copy h2 { margin: 4px 0; font-size: 1.2rem; }
.game-status-copy p:last-child { margin: 0; color: var(--muted); font-size: .8rem; }
.game-status-facts { display: grid; grid-template-columns: repeat(3, minmax(92px, 1fr)); }
.game-status-facts div { min-width: 112px; padding: 2px 18px; border-left: 1px solid var(--line); }
.game-status-facts span, .game-status-facts strong, .game-status-facts small { display: block; }
.game-status-facts span { color: var(--muted); font-size: .72rem; }
.game-status-facts strong { display: inline-block; margin-top: 4px; font-size: 1.05rem; }
.game-status-facts small { display: inline; margin-left: 3px; color: var(--muted); font-size: .68rem; }
.game-layout { display: grid; grid-template-columns: minmax(340px, .85fr) minmax(0, 1.15fr); gap: 18px; align-items: stretch; }
.game-config-panel, .active-race-panel, .horse-catalog-panel { padding: 22px; }
.game-toggle { margin-top: 16px; border-top: 1px solid var(--line); }
.game-config-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 16px; transition: opacity .16s ease; }
.game-config-fields.disabled { opacity: .48; }
.game-config-fields > label { display: grid; gap: 6px; color: #454952; font-size: .75rem; font-weight: 700; }
.game-config-fields > label > small { color: var(--muted); font-size: .67rem; font-weight: 400; }
.input-unit { position: relative; }
.input-unit input { width: 100%; padding-right: 36px; }
.input-unit span { position: absolute; right: 11px; top: 50%; color: var(--muted); font-size: .72rem; transform: translateY(-50%); pointer-events: none; }
.active-race-content { min-height: 215px; margin-top: 16px; border-top: 1px solid var(--line); }
.active-race-content .empty-state { min-height: 215px; }
.active-race-summary { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.active-race-summary div { padding: 14px 12px; border-left: 1px solid var(--line); }
.active-race-summary div:first-child { padding-left: 0; border-left: 0; }
.active-race-summary span, .active-race-summary strong { display: block; }
.active-race-summary span { color: var(--muted); font-size: .68rem; }
.active-race-summary strong { margin-top: 4px; font-size: .8rem; }
.active-horse-list { display: grid; grid-template-columns: repeat(5, 1fr); }
.active-horse-list > div { min-width: 0; padding: 16px 10px; border-left: 1px solid var(--line); text-align: center; }
.active-horse-list > div:first-child { border-left: 0; }
.active-horse-list span { width: 24px; height: 24px; display: grid; place-items: center; margin: 0 auto 8px; border-radius: 50%; color: white; background: var(--blue); font-size: .7rem; font-weight: 800; }
.active-horse-list strong, .active-horse-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-horse-list strong { font-size: .76rem; }
.active-horse-list small { margin-top: 4px; color: var(--coral); font-size: .68rem; font-weight: 800; }
.horse-catalog-panel { margin-top: 18px; }
.horse-catalog { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.horse-catalog-row { min-width: 0; display: grid; grid-template-columns: 24px 18px minmax(0, 1fr); align-items: center; gap: 8px; padding: 14px 12px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.horse-catalog-row:nth-child(5n+1) { border-left: 0; }
.horse-catalog-row:nth-last-child(-n+5) { border-bottom: 0; }
.horse-catalog-row > span { color: var(--muted); font: .68rem/1 "SFMono-Regular", Consolas, monospace; }
.horse-catalog-row svg { width: 16px; color: var(--green); }
.horse-catalog-row strong { overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.nonsense-panel { margin-top: 18px; padding: 22px; }
.nonsense-layout { display: grid; grid-template-columns: 1.15fr 1fr .8fr; gap: 0; margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.nonsense-summary { display: grid; grid-template-columns: 1fr 1fr; }
.nonsense-summary div { min-width: 0; padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.nonsense-summary div:nth-last-child(-n+2) { border-bottom: 0; }
.nonsense-summary span, .nonsense-summary strong, .nonsense-summary small { display: block; }
.nonsense-summary span { color: var(--muted); font-size: .68rem; }
.nonsense-summary strong { display: inline-block; margin-top: 4px; font-size: 1.1rem; }
.nonsense-summary small { display: inline; margin-left: 3px; color: var(--muted); font-size: .68rem; }
.nonsense-current { min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 18px 20px; border-right: 1px solid var(--line); }
.nonsense-current span, .nonsense-current small { color: var(--muted); font-size: .7rem; }
.nonsense-current strong { margin: 7px 0; font-size: .88rem; line-height: 1.5; }
.nonsense-commands { display: grid; grid-template-columns: auto 1fr; align-content: center; gap: 9px 12px; padding: 16px 18px; }
.nonsense-commands code { color: var(--blue); font-size: .7rem; font-weight: 800; }
.nonsense-commands span { color: var(--muted); font-size: .7rem; }
.game-history-panel { margin-top: 18px; }
.game-history-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px 16px; }
.game-history-head h2 { margin: 3px 0 0; font-size: 1.05rem; }
.game-history-panel th, .game-history-panel td { white-space: nowrap; }
.welcome-editor { display: grid; gap: 8px; margin-top: 22px; color: #454952; font-size: .875rem; font-weight: 700; }
.welcome-editor small { color: var(--muted); font-size: .75rem; font-weight: 400; }
.welcome-editor code { color: var(--blue); }
.admin-form { display: grid; gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.admin-form label { display: grid; gap: 7px; color: #454952; font-size: .82rem; font-weight: 700; }
.admin-form-actions { display: flex; justify-content: space-between; gap: 8px; }
.operator-head { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .85rem; }
.operator-head span { color: var(--muted); }
.operator-list { display: grid; margin-top: 8px; }
.operator-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.operator-row:first-child { border-top: 0; }
.operator-row strong { font-size: .85rem; }
.operator-row small { color: var(--muted); font-size: .72rem; }
.operator-role { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--blue); font-size: .75rem; font-weight: 800; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding-top: 18px; border-top: 1px solid #f0bbb7; }
.danger-zone strong, .danger-zone small { display: block; }
.danger-zone strong { color: var(--coral); font-size: .85rem; }
.danger-zone small { max-width: 240px; margin-top: 4px; color: var(--muted); font-size: .72rem; line-height: 1.45; }

.table-panel { min-height: 300px; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 17px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fafafb; font-size: .75rem; text-transform: uppercase; }
td { font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.cell-main { display: block; font-weight: 750; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; }
.truncate { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; }
.profile-nickname { display: block; }
.nickname-history-count { padding: 0; margin-top: 4px; border: 0; color: var(--blue); background: transparent; font-size: .68rem; font-weight: 750; }
.nickname-history-count:hover { text-decoration: underline; }
.empty-state { min-height: 280px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-state svg { width: 32px; height: 32px; margin-bottom: 4px; }
.empty-state strong { color: var(--ink); }
.empty-state span { font-size: .875rem; }
.empty-state.compact-empty { min-height: 100px; }

.memo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.memo-card { min-height: 170px; display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.memo-card:hover { border-color: #bec5d2; box-shadow: 0 5px 18px rgba(30,35,45,.06); }
.memo-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.memo-card h3 { margin: 0; font-size: 1rem; }
.memo-card p { display: -webkit-box; overflow: hidden; margin: 14px 0; color: #535761; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.memo-card small { margin-top: auto; color: var(--muted); }
.segmented { width: fit-content; display: flex; padding: 3px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.segmented button { min-height: 36px; padding: 0 16px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-weight: 700; }
.segmented button.active { color: white; background: var(--ink); }
.activity-table { min-height: 430px; }
.rank { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }
.value-cell { font-weight: 800; font-variant-numeric: tabular-nums; }

.typing-toolbar { min-height: 48px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.typing-periods { margin-bottom: 14px; }
.typing-period-label { margin-top: 10px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.typing-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.typing-summary article { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; grid-template-rows: 22px 30px; align-items: center; padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.typing-summary svg { grid-row: 1 / 3; width: 21px; color: var(--coral); }
.typing-summary span { color: var(--muted); font-size: .78rem; font-weight: 700; }
.typing-summary strong { align-self: end; overflow: hidden; font-size: 1.4rem; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.typing-summary small { align-self: end; color: var(--muted); font-size: .75rem; }
.typing-grid { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(520px, 1.28fr); gap: 18px; align-items: start; }
.typing-trend-panel { min-height: 430px; padding: 21px; }
.typing-trend { max-height: 470px; overflow-y: auto; display: grid; gap: 11px; margin-top: 20px; padding-right: 4px; }
.typing-trend-row { display: grid; grid-template-columns: 42px minmax(80px, 1fr) 68px; align-items: center; gap: 9px; }
.typing-trend-row > span { color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.typing-trend-row > strong { text-align: right; font-size: .78rem; font-variant-numeric: tabular-nums; }
.typing-trend-row > strong small { margin-left: 2px; color: var(--muted); font-size: .65rem; }
.typing-trend-row progress { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 4px; background: #eceef2; appearance: none; }
.typing-trend-row progress::-webkit-progress-bar { border-radius: 4px; background: #eceef2; }
.typing-trend-row progress::-webkit-progress-value { border-radius: 4px; background: var(--coral); }
.typing-trend-row progress::-moz-progress-bar { border-radius: 4px; background: var(--coral); }
.typing-ranking-panel { min-height: 430px; }
.typing-ranking-head { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.typing-ranking-head h2 { margin: 3px 0 0; font-size: 1.05rem; }

.system-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.system-grid > .panel, .logs-panel { padding: 22px; }
.service-list { display: grid; margin-top: 18px; }
.service-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.service-row:first-child { border-top: 0; }
.service-row strong, .service-row small { display: block; }
.service-row small { margin-top: 3px; color: var(--muted); }
.audit-list { max-height: 280px; overflow: auto; margin-top: 15px; }
.audit-entry { display: grid; grid-template-columns: 1fr auto; gap: 7px 16px; padding: 11px 0; border-top: 1px solid var(--line); }
.audit-entry:first-child { border-top: 0; }
.audit-entry strong { font-size: .85rem; }
.audit-entry time, .audit-entry span { color: var(--muted); font-size: .75rem; }
.audit-entry span { grid-column: 1 / -1; }
.logs-panel pre { max-height: 430px; overflow: auto; margin: 18px 0 0; padding: 16px; border-radius: 6px; color: #cfd3db; background: #1d2025; font: 12px/1.65 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; word-break: break-word; }

dialog { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 24px 70px rgba(20,23,30,.28); }
dialog::backdrop { background: rgba(19,21,26,.55); backdrop-filter: blur(2px); }
.dialog-card { display: grid; gap: 17px; padding: 24px; }
.dialog-card.compact { width: min(440px, 100%); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-head h2 { margin: 3px 0 0; font-size: 1.2rem; }
.dialog-card label input { width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.dialog-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; padding-top: 5px; }
.dialog-actions.end { grid-template-columns: 1fr auto auto; }
.dialog-subject { margin: 0; color: var(--muted); }
.nickname-history-dialog { min-height: 260px; }
.nickname-history-list { max-height: min(520px, 58vh); overflow-y: auto; display: grid; }
.nickname-history-entry { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 10px 16px; padding: 13px 2px; border-top: 1px solid var(--line); }
.nickname-history-entry:first-child { border-top: 0; }
.nickname-history-entry time, .nickname-history-entry small { color: var(--muted); font-size: .7rem; }
.nickname-history-entry > div { min-width: 0; display: flex; align-items: center; gap: 7px; }
.nickname-history-entry > div span, .nickname-history-entry > div strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nickname-history-entry > div svg { width: 15px; flex: 0 0 auto; color: var(--muted); }
.nickname-history-entry > div strong { color: var(--blue); }
.password-hint { margin: -7px 0 0; color: var(--muted); font-size: .78rem; }
.form-error { min-height: 18px; margin: 0; color: var(--coral); font-size: .8rem; }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 8px; }
.toast { min-width: 270px; max-width: 390px; padding: 13px 16px; border: 1px solid #353941; border-radius: 6px; color: white; background: #25282e; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.error { border-color: #a9433d; background: #71312d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .screen-panel { display: grid; grid-template-columns: 1fr 260px; align-items: start; }
  .screen-panel .panel-head { align-self: start; }
  .phone-frame { grid-column: 2; grid-row: 1 / 3; margin: 0 auto; }
  .memo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room-identity { align-items: flex-start; flex-direction: column; }
  .room-facts { width: 100%; }
  .room-facts div:first-child { border-left: 0; padding-left: 0; }
  .room-management-grid { grid-template-columns: 1fr; }
  .game-status-panel { align-items: flex-start; flex-direction: column; }
  .game-status-facts { width: 100%; }
  .game-status-facts div:first-child { padding-left: 0; border-left: 0; }
  .game-layout { grid-template-columns: 1fr; }
  .nonsense-layout { grid-template-columns: 1fr 1fr; }
  .nonsense-summary { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .history-toolbar { grid-template-columns: minmax(240px, 1fr) 140px 130px; }
  .history-toolbar .button { min-width: 0; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .typing-summary { grid-template-columns: repeat(2, 1fr); }
  .typing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; padding-bottom: 68px; }
  .sidebar { position: fixed; z-index: 20; top: auto; bottom: 0; width: 100%; height: 68px; display: block; padding: 0; border-top: 1px solid #34373e; }
  .brand, .sidebar-foot { display: none; }
  .nav-list { height: 100%; display: grid; grid-template-columns: repeat(10, 1fr); gap: 0; }
  .nav-item { height: 68px; flex-direction: column; justify-content: center; gap: 3px; padding: 0; border-radius: 0; font-size: .7rem; }
  .nav-item.active::before { display: none; }
  .nav-item.active svg { margin-left: 0; }
  .topbar { min-height: auto; align-items: flex-start; padding: 15px 16px; }
  .topbar h1 { font-size: 1.25rem; }
  .room-picker span { display: none; }
  select { width: min(46vw, 250px); }
  .content { padding: 16px 14px 30px; }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .status-item:nth-child(2) { border-right: 0; }
  .status-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .summary-grid { gap: 8px; }
  .dashboard-operator-list { grid-template-columns: 1fr; }
  .dashboard-operator + .dashboard-operator { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .summary-grid article { grid-template-columns: 30px 1fr auto; padding: 12px; }
  .voice-stage { min-height: 210px; flex-direction: column; text-align: center; }
  .screen-panel { display: block; }
  .phone-frame { margin-top: 18px; }
  .memo-grid, .system-grid { grid-template-columns: 1fr; }
  .toggle-list { grid-template-columns: 1fr; }
  .game-settings-grid { grid-template-columns: 1fr; }
  .game-status-copy { align-items: flex-start; }
  .game-config-fields { grid-template-columns: 1fr; }
  .active-race-summary { grid-template-columns: 1fr 1fr; }
  .active-race-summary div:nth-child(3) { padding-left: 0; border-left: 0; }
  .active-horse-list { grid-template-columns: repeat(5, minmax(78px, 1fr)); overflow-x: auto; }
  .horse-catalog { grid-template-columns: 1fr 1fr; }
  .horse-catalog-row:nth-child(5n+1) { border-left: 1px solid var(--line); }
  .horse-catalog-row:nth-child(2n+1) { border-left: 0; }
  .horse-catalog-row:nth-last-child(-n+5) { border-bottom: 1px solid var(--line); }
  .horse-catalog-row:nth-last-child(-n+2) { border-bottom: 0; }
  .nonsense-layout { grid-template-columns: 1fr; }
  .nonsense-current { border-top: 1px solid var(--line); border-right: 0; }
  .nonsense-commands { border-top: 1px solid var(--line); }
  .history-toolbar { grid-template-columns: 1fr 1fr; }
  .history-search { grid-column: 1 / -1; }
  .history-panel { height: min(650px, calc(100vh - 230px)); min-height: 430px; }
  .history-list { padding: 16px 12px 24px; }
  .photo-toolbar { grid-template-columns: 1fr 1fr; }
  .photo-toolbar .search-field { grid-column: 1 / -1; }
  .photo-summary { align-items: flex-start; flex-direction: column; }
  .photo-summary > div { width: 100%; }
  .photo-actions { justify-content: flex-start; flex-wrap: wrap; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .chat-message-body { max-width: 82%; }
  .system-grid .panel-head { align-items: flex-start; flex-wrap: wrap; }
  .system-grid .panel-head .inline-actions { width: 100%; gap: 8px; }
  .system-grid .panel-head .inline-actions .button { flex: 1; padding-inline: 9px; white-space: nowrap; }
  .section-tools { align-items: stretch; }
  .form-grid { grid-template-columns: 1fr; }
  .nickname-history-entry { grid-template-columns: 1fr auto; }
  .nickname-history-entry > div { grid-column: 1 / -1; grid-row: 1; }
  .nickname-history-entry time { grid-column: 1; grid-row: 2; }
  .nickname-history-entry small { grid-column: 2; grid-row: 2; }
  .typing-trend-panel { min-height: 340px; }
  .dialog-actions { grid-template-columns: auto 1fr; }
  .dialog-actions .button.subtle { grid-column: 1; }
  .dialog-actions .button.primary { grid-column: 2; }
  th, td { padding: 12px; }
}

@media (max-width: 480px) {
  .login-panel { padding: 28px 22px; }
  .topbar { flex-direction: column; gap: 10px; }
  .topbar-actions { width: 100%; }
  .nav-item { font-size: .62rem; }
  .nav-item span { white-space: nowrap; }
  .room-picker { flex: 1; }
  select { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .game-status-panel { padding: 16px; }
  .game-status-copy { flex-direction: column; gap: 10px; }
  .game-status-facts div { min-width: 0; padding: 2px 8px; }
  .game-status-facts strong { font-size: .88rem; }
  .game-config-panel, .active-race-panel, .horse-catalog-panel { padding: 17px 14px; }
  .typing-toolbar { align-items: stretch; flex-direction: column; gap: 0; }
  .typing-periods { width: 100%; }
  .typing-periods button { flex: 1; padding-inline: 8px; }
  .typing-period-label { margin: -5px 0 13px; text-align: right; }
  .typing-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .typing-summary article { grid-template-columns: 28px minmax(0, 1fr) auto; padding: 12px; }
  .typing-summary strong { font-size: 1.15rem; }
  .typing-trend-panel { padding: 16px 13px; }
  .typing-trend-row { grid-template-columns: 36px minmax(60px, 1fr) 60px; gap: 7px; }
  .status-item { padding: 12px; }
  .button-row .button { flex: 1; }
  .memo-grid { grid-template-columns: minmax(0, 1fr); }
  .room-facts { grid-template-columns: 1fr 1fr; gap: 14px 0; }
  .room-facts div:nth-child(3) { border-left: 0; padding-left: 0; }
  .room-settings .panel-head { align-items: flex-start; }
  .admin-form-actions { align-items: stretch; flex-direction: column-reverse; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .history-panel { height: calc(100vh - 248px); min-height: 390px; }
  .history-list { padding-inline: 9px; }
  .history-avatar { width: 31px; height: 31px; font-size: .7rem; }
  .chat-message { gap: 6px; }
  .chat-message-body { max-width: 86%; }
  .chat-bubble { padding: 8px 9px; font-size: .9rem; }
  .history-media { grid-template-columns: repeat(2, minmax(80px, 1fr)); }
  .history-raw pre { max-width: 70vw; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .photo-info { grid-template-columns: 1fr; gap: 3px; }
  .photo-actions .button { flex: 1; }
  .photo-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .photo-dialog-card { gap: 10px; padding: 12px; }
}
