/* ───── 프레임 장식: 모서리 대각선 컷 · 이중선 · 그라데이션 선 ─────
   AIHORRORCOMPANY의 chamfer_style(모서리 깎기 + 안쪽 보조선 + 위쪽 강조 막대)을 웹 CSS로 옮긴 것.
   요소 자체는 clip-path로 모서리를 깎고, ::after 한 장에 바깥선·안쪽선·강조 막대를 함께 그린다.
   조절값: --fx-k 모서리 컷, --fx-w 바깥선 두께, --fx-g 안쪽선 거리, --fx-iw 안쪽선 두께,
          --fx-bl/--fx-bh 강조 막대 길이·두께, --fx-c 선 기본색, --fx-hi 왼쪽 위 밝은 색, --fx-lo 오른쪽 아래 색. */
:root {
  --fx-line: #5b4f3a;
  --fx-glow: #ffc928e6;
  --fx-fade: #ffc92833;
  --fx-panel: linear-gradient(180deg,#ffffff08,#ffffff00 34%), radial-gradient(120% 70% at 50% 118%,#ffc92812,#ffc92800 64%);
}

/* 공통 장치 */
.panel, .brief-card, .cine, .hero, dialog, .place-panel, .board, .verdict, .panel-card, .event-banner, .social-invite,
.ready-box, .char-card, .suspect, .vote-done, .floor, .chat-drawer, .map-drawer, .strip, .dossier-id,
.phase-investigation .chat, .dossier-body > section, .round, .turn-call, .survey-turn, .mission-card, .mission, .tip,
.excuse-grid article, .evi, #app details, dialog details, .seat, .seat-slot, .tile, .plan, .cover, .dock, .toast,
.button, .chip, .g-steps li, .phases li, .floor-tabs button, .search, #login-screen, .studio .card, .studio .array-item,
.studio .error, .studio .success, .studio header .actions button, .studio aside button, .studio nav button,
.studio .section-head button, .studio .fold-actions button, .studio .map-section .actions button,
.studio .map-name button, .studio .row-head button, .studio .card > .remove, .studio dialog button,
.studio #login-screen button, .plan .clue-pin, .clue-chip, .studio #content .map-floor .clue-pin {
  --fx-k: 7px; --fx-w: 1px; --fx-g: 0px; --fx-iw: 0px; --fx-bl: 0px; --fx-bh: 0px;
  --fx-kk: calc(var(--fx-k) * var(--frame-corner, 1));
  --fx-c: var(--fx-line); --fx-hi: var(--fx-glow); --fx-lo: var(--fx-fade);
  --fx-shape: polygon(calc(var(--fx-kk) + 0px * .4142) 0px, calc(100% - var(--fx-kk) - 0px * .4142) 0px, calc(100% - 0px) calc(var(--fx-kk) + 0px * .4142), calc(100% - 0px) calc(100% - var(--fx-kk) - 0px * .4142), calc(100% - var(--fx-kk) - 0px * .4142) calc(100% - 0px), calc(var(--fx-kk) + 0px * .4142) calc(100% - 0px), 0px calc(100% - var(--fx-kk) - 0px * .4142), 0px calc(var(--fx-kk) + 0px * .4142));
  --fx-ring: polygon(evenodd, calc(var(--fx-kk) + 0px * .4142) 0px, calc(100% - var(--fx-kk) - 0px * .4142) 0px, calc(100% - 0px) calc(var(--fx-kk) + 0px * .4142), calc(100% - 0px) calc(100% - var(--fx-kk) - 0px * .4142), calc(100% - var(--fx-kk) - 0px * .4142) calc(100% - 0px), calc(var(--fx-kk) + 0px * .4142) calc(100% - 0px), 0px calc(100% - var(--fx-kk) - 0px * .4142), 0px calc(var(--fx-kk) + 0px * .4142), calc(var(--fx-kk) + 0px * .4142) 0px, calc(var(--fx-kk) + var(--fx-w) * .4142) var(--fx-w), calc(100% - var(--fx-kk) - var(--fx-w) * .4142) var(--fx-w), calc(100% - var(--fx-w)) calc(var(--fx-kk) + var(--fx-w) * .4142), calc(100% - var(--fx-w)) calc(100% - var(--fx-kk) - var(--fx-w) * .4142), calc(100% - var(--fx-kk) - var(--fx-w) * .4142) calc(100% - var(--fx-w)), calc(var(--fx-kk) + var(--fx-w) * .4142) calc(100% - var(--fx-w)), var(--fx-w) calc(100% - var(--fx-kk) - var(--fx-w) * .4142), var(--fx-w) calc(var(--fx-kk) + var(--fx-w) * .4142), calc(var(--fx-kk) + var(--fx-w) * .4142) var(--fx-w), calc(var(--fx-kk) + 12px) var(--fx-w), calc(var(--fx-kk) + 12px + var(--fx-bl)) var(--fx-w), calc(var(--fx-kk) + 12px + var(--fx-bl)) calc(var(--fx-w) + var(--fx-bh)), calc(var(--fx-kk) + 12px) calc(var(--fx-w) + var(--fx-bh)), calc(var(--fx-kk) + 12px) var(--fx-w), calc(var(--fx-kk) + var(--fx-w) * .4142) var(--fx-w));
  --fx-ring2: polygon(evenodd, calc(var(--fx-kk) + var(--fx-g) * .4142) var(--fx-g), calc(100% - var(--fx-kk) - var(--fx-g) * .4142) var(--fx-g), calc(100% - var(--fx-g)) calc(var(--fx-kk) + var(--fx-g) * .4142), calc(100% - var(--fx-g)) calc(100% - var(--fx-kk) - var(--fx-g) * .4142), calc(100% - var(--fx-kk) - var(--fx-g) * .4142) calc(100% - var(--fx-g)), calc(var(--fx-kk) + var(--fx-g) * .4142) calc(100% - var(--fx-g)), var(--fx-g) calc(100% - var(--fx-kk) - var(--fx-g) * .4142), var(--fx-g) calc(var(--fx-kk) + var(--fx-g) * .4142), calc(var(--fx-kk) + var(--fx-g) * .4142) var(--fx-g), calc(var(--fx-kk) + calc(var(--fx-g) + var(--fx-iw)) * .4142) calc(var(--fx-g) + var(--fx-iw)), calc(100% - var(--fx-kk) - calc(var(--fx-g) + var(--fx-iw)) * .4142) calc(var(--fx-g) + var(--fx-iw)), calc(100% - calc(var(--fx-g) + var(--fx-iw))) calc(var(--fx-kk) + calc(var(--fx-g) + var(--fx-iw)) * .4142), calc(100% - calc(var(--fx-g) + var(--fx-iw))) calc(100% - var(--fx-kk) - calc(var(--fx-g) + var(--fx-iw)) * .4142), calc(100% - var(--fx-kk) - calc(var(--fx-g) + var(--fx-iw)) * .4142) calc(100% - calc(var(--fx-g) + var(--fx-iw))), calc(var(--fx-kk) + calc(var(--fx-g) + var(--fx-iw)) * .4142) calc(100% - calc(var(--fx-g) + var(--fx-iw))), calc(var(--fx-g) + var(--fx-iw)) calc(100% - var(--fx-kk) - calc(var(--fx-g) + var(--fx-iw)) * .4142), calc(var(--fx-g) + var(--fx-iw)) calc(var(--fx-kk) + calc(var(--fx-g) + var(--fx-iw)) * .4142), calc(var(--fx-kk) + calc(var(--fx-g) + var(--fx-iw)) * .4142) calc(var(--fx-g) + var(--fx-iw)));
  border-width: 0 !important;
  border-radius: 0 !important;
  clip-path: var(--fx-shape);
}
.panel::after, .brief-card::after, .cine::after, .hero::after, dialog::after, .place-panel::after, .board::after,
.verdict::after, .panel-card::after, .event-banner::after, .social-invite::after, .ready-box::after, .char-card::after,
.suspect::after, .vote-done::after, .floor::after, .chat-drawer::after, .map-drawer::after, .strip::after,
.dossier-id::after, .phase-investigation .chat::after, .dossier-body > section::after, .round::after, .turn-call::after,
.survey-turn::after, .mission-card::after, .mission::after, .tip::after, .excuse-grid article::after, .evi::after,
#app details::after, dialog details::after, .seat::after, .seat-slot::after, .tile::after, .plan::after, .cover::after,
.dock::after, .toast::after, .button::after, .chip::after, .g-steps li::after, .phases li::after,
.floor-tabs button::after, .search::after, #login-screen::after, .studio .card::after, .studio .array-item::after,
.studio .error::after, .studio .success::after, .studio header .actions button::after, .studio aside button::after,
.studio nav button::after, .studio .section-head button::after, .studio .fold-actions button::after,
.studio .map-section .actions button::after, .studio .map-name button::after, .studio .row-head button::after,
.studio .card > .remove::after, .studio dialog button::after, .studio #login-screen button::after,
.plan .clue-pin::after, .clue-chip::after, .studio #content .map-floor .clue-pin::after {
  position: absolute; z-index: 3; inset: 0; content: ""; pointer-events: none;
  clip-path: var(--fx-ring);
  background: var(--fx-paint, linear-gradient(135deg, var(--fx-hi) 0%, var(--fx-c) 26%, var(--fx-c) 74%, var(--fx-lo) 100%));
  transition: opacity .15s;
}
/* 원래 위치 지정이 없는 요소만 기준점으로 만든다(지도 방·고정 창·붙는 패널은 그대로). */
.panel, .brief-card, .board, .verdict, .panel-card, .event-banner, .social-invite, .ready-box, .char-card, .suspect,
.vote-done, .floor, .chat-drawer, .map-drawer, .strip, .phase-investigation .chat, .dossier-body > section, .round,
.turn-call, .survey-turn, .mission-card, .tip, .excuse-grid article, .evi, #app details, dialog details, .seat,
.seat-slot, .button, .chip, .g-steps li, .phases li, .floor-tabs button, .search, #login-screen, .studio .card,
.studio .array-item, .studio .error, .studio .success, .studio header .actions button, .studio aside button,
.studio nav button, .studio .section-head button, .studio .fold-actions button, .studio .map-section .actions button,
.studio .map-name button, .studio .row-head button, .studio .card > .remove, .studio dialog button,
.studio #login-screen button, .clue-chip { position: relative; }
/* 모서리를 깎으면 바깥 테두리 밖 초점 표시가 잘리므로 안쪽에 그린다. */
.button:focus-visible, .chip:focus-visible, .seat:focus-visible, .tile:focus-visible, .floor-tabs button:focus-visible, .g-steps li button:focus-visible, .suspect:focus-visible { outline-offset: -4px; }

/* 큰 패널: 이중선 + 위쪽 강조 막대 + 은은한 바닥빛.
   안쪽 보조선은 ::before에 더 흐리게 그린다(배경 그림을 ::before로 쓰는 .cine, .hero는 제외). */
.panel::before, .brief-card::before, dialog::before, .place-panel::before, .board::before, .verdict::before, .panel-card::before,
.event-banner::before, .social-invite::before, .char-card::before, .suspect::before, .strip::before, .dossier-id::before,
.dossier-body > section::before, .phase-investigation .chat::before {
  position: absolute; z-index: 3; inset: 0; content: ""; pointer-events: none;
  clip-path: var(--fx-ring2);
  background: linear-gradient(135deg, var(--fx-hi), var(--fx-c) 30%, var(--fx-c) 70%, var(--fx-lo));
  opacity: .42;
}
.panel, .brief-card, .cine, .hero, dialog, .place-panel, .board, .verdict, .panel-card, .event-banner, .social-invite, .char-card, .suspect,
.strip, .dossier-id, .dossier-body > section, .phase-investigation .chat {
  --fx-k: 14px; --fx-w: 1.5px; --fx-g: 5px; --fx-iw: 1px; --fx-bl: 54px; --fx-bh: 2.5px;
}
.panel, .brief-card:not(.accent), dialog, .place-panel, .board, .social-invite, .ready-box, .floor, .strip, .dossier-id, .dossier-body > section:not(.secret), .phase-investigation .chat, .chat-drawer, .map-drawer, .round, .vote-done, .suspect, .char-card {
  background-image: var(--fx-panel);
}
.cine, .hero { --fx-k: 18px; --fx-w: 2px; --fx-g: 6px; --fx-bl: 76px; --fx-bh: 3px; }
/* 중간 상자: 한 줄 + 짧은 컷 */
.round, .turn-call, .survey-turn, .mission-card, .mission, .tip, .ready-box, .chat-drawer, .map-drawer, .vote-done, .floor, .cover, .plan, .dock { --fx-k: 11px; --fx-w: 1.5px; }
.excuse-grid article, .evi, #app details, dialog details, .seat, .toast { --fx-k: 9px; --fx-w: 1px; }
.tile { --fx-k: 9px; --fx-w: 1.5px; --fx-c: #4a4d5c; --fx-hi: #9aa0b8; --fx-lo: #4a4d5c; }
.seat-slot { --fx-k: 8px; }
.cover { --fx-c: #4a4232; --fx-hi: #ffc928b3; }
.plan { --fx-c: #30333d; --fx-hi: #6b6f80; --fx-lo: #30333d; }
/* 작은 버튼류 */
.button { --fx-k: 8px; --fx-w: 1.5px; }
.button.small, .chip, .g-steps li, .phases li, .floor-tabs button { --fx-k: 6px; --fx-w: 1px; }

/* 버튼 */
.button.primary {
  background: linear-gradient(180deg,#ffdd6e 0%,#ffc928 46%,#eaa80b 100%);
  --fx-w: 0px; --fx-g: 3px; --fx-iw: 1px; --fx-paint: linear-gradient(90deg,#5a380044,#5a3800aa 50%,#5a380044);
}
.button.primary:hover { background: linear-gradient(180deg,#ffe58c 0%,#ffd24a 46%,#f2b41c 100%); }
.button.outline { background: linear-gradient(180deg,#2d291f,#1c1913); --fx-c: #6a5c42; }
.button.outline:hover { background: linear-gradient(180deg,#3a3426,#221e16); --fx-c: #a88c55; --fx-hi: #ffe08a; }
.room-code [data-action="notebook"] { --fx-c: #ffc92888; }
.chip { background-image: linear-gradient(180deg,#ffffff06,#ffffff00); }
.chip:hover { --fx-c: #85744f; }
.search:focus-within { --fx-c: var(--accent); }

/* 선택·강조 상태: 테두리 대신 선 색을 바꾼다 */
.chip.active, .g-steps li.current, .phases li.current, .floor-tabs button.on, .seat-slot.active, .turn-call.mine, .vote-done, .char-card.mine, .seat.selected {
  --fx-c: #ffc928b0; --fx-hi: #fff1b8; --fx-lo: #ffc92880;
}
.filters.seats .chip.active { --fx-c: #8a5a1a; --fx-hi: #ffe2a8; }
.case-card:hover .cover, .case-card:focus-within .cover, .char-card:hover, .seat:hover:not(:disabled), .suspect:hover { --fx-c: #a88c55; --fx-hi: #ffe08a; }
.char-card.mine { --fx-w: 2px; box-shadow: none; }
.hud.talking .turn-call { --fx-c: #7d6cff88; --fx-hi: #c4bbff; --fx-lo: #7d6cff44; }
.brief-card.accent, .panel-card.twist, .event-banner, .mission, .evi.event, .tip { --fx-c: #8a6c33; }
.dossier-body .secret { --fx-c: #ff4d4d66; --fx-hi: #ff9a8a; --fx-lo: #ff4d4d33; }
.mission.win { --fx-c: #4fd18b88; --fx-hi: #b9f3d0; --fx-lo: #4fd18b44; }
.mission.lose { --fx-c: #ff6b6b77; --fx-hi: #ffc2c2; --fx-lo: #ff6b6b44; }
.evi.private { --fx-c: #7d6cff66; --fx-hi: #c4bbff; --fx-lo: #7d6cff33; }
.tile:hover { --fx-c: #8d8995; --fx-hi: #e2e0ea; }
.tile.can { --fx-c: #ffc928b0; --fx-hi: #fff1b8; --fx-lo: #ffc92880; box-shadow: none; animation: none; }
.tile.can::after { animation: fx-pulse 2.2s ease-in-out infinite; }
@keyframes fx-pulse { 50% { opacity: .5; } }
.tile.sel { --fx-c: #f2f0f6; --fx-hi: #ffffff; --fx-lo: #c9c6d2; }
.tile.scene, .place-panel.scene { --fx-c: #b83434aa; --fx-hi: #ff8a7a; --fx-lo: #b8343455; }

/* 화면 위아래 줄과 제목 밑줄 */
.topbar { border-bottom-color: transparent; background-image: linear-gradient(90deg,#ffc92800 0%,#ffc928a6 16%,#5b4f3a 42%,#5b4f3a00 100%); background-size: 100% 1px; background-position: bottom; background-repeat: no-repeat; }
.bottom-nav { border-top-color: transparent; background-image: linear-gradient(90deg,#5b4f3a00,#ffc92870 50%,#5b4f3a00); background-size: 100% 1px; background-position: top; background-repeat: no-repeat; }
.g-steps { border-bottom-color: transparent; background-image: linear-gradient(90deg,#ffc928a6,#5b4f3a 30%,#5b4f3a00); background-size: 100% 1px; background-position: bottom; background-repeat: no-repeat; }
.sheet { border-left: 1px solid; border-image: linear-gradient(180deg,#ffc928a6,#5b4f3a 30%,#5b4f3a33) 1; }
.tab-heading h1, .section-head h2 {
  padding-bottom: 12px;
  background: linear-gradient(var(--accent),var(--accent)) 0 100% / 46px 3px no-repeat,
              linear-gradient(90deg,#ffc92899,#5b4f3a 30%,#5b4f3a00) 54px calc(100% - 1px) / min(360px, 70%) 1px no-repeat;
}

/* 입력칸은 각진 모양으로 맞춘다 */
form input, form select, textarea, .messages, .seat-slots { border-radius: 3px; }
.avatar { border-radius: 4px; }

@media (prefers-reduced-motion: reduce) { .tile.can::after { animation: none; } }

/* ───── 작가 편집기(작가의 책상): 게임과 같은 프레임 크기 ───── */
#login-screen, .studio .card { --fx-k: 14px; --fx-w: 1.5px; --fx-g: 5px; --fx-iw: 1px; --fx-bl: 54px; --fx-bh: 2.5px; }
#login-screen::before, .studio .card::before {
  position: absolute; z-index: 3; inset: 0; content: ""; pointer-events: none;
  clip-path: var(--fx-ring2);
  background: linear-gradient(135deg, var(--fx-hi), var(--fx-c) 30%, var(--fx-c) 70%, var(--fx-lo));
  opacity: .42;
}
.studio .array-item, .studio .error, .studio .success { --fx-k: 9px; }
.studio .error { --fx-c: #c2554a99; --fx-hi: #ff9a8a; --fx-lo: #c2554a55; }
.studio .success { --fx-c: #4fd18b88; --fx-hi: #b9f3d0; --fx-lo: #4fd18b44; }
.studio header .actions button, .studio .section-head button { --fx-k: 8px; --fx-w: 1.5px; }
.studio nav button, .studio aside #list button, .studio .row-head button, .studio .fold-actions button, .studio .map-section .actions button, .studio .map-name button { --fx-k: 6px; }
.studio #login-screen button { --fx-k: 8px; --fx-w: 1.5px; }

/* ───── 지도 번호 단서 버튼: 팔각형 표식 ───── */
.plan .clue-pin, .studio #content .map-floor .clue-pin {
  --fx-k: 7px; --fx-w: 1.5px; --fx-c: #8d8995; --fx-hi: #e2e0ea; --fx-lo: #6b6f80;
  background: linear-gradient(160deg,#343744,#1d1f27); color: #f2f0f6; font-family: var(--mono, monospace); line-height: 24px;
}
.studio #content .map-floor .clue-pin { line-height: 22px; --fx-c: #ffc928b0; --fx-hi: #fff1b8; --fx-lo: #ffc92880; color: var(--accent-hover); }
.plan .clue-pin:hover { --fx-c: #e2e0ea; --fx-hi: #fff; }
.plan .clue-pin.can { --fx-c: #ffc928; --fx-hi: #fff1b8; --fx-lo: #ffc928b0; background: linear-gradient(160deg,#4a3a14,#241d0c); color: var(--accent-hover); box-shadow: none; }
.plan .clue-pin.can::after { animation: fx-pulse 2.2s ease-in-out infinite; }
.plan .clue-pin.found { --fx-paint: linear-gradient(90deg,#5a380066,#5a3800aa); background: linear-gradient(180deg,#ffd86a,#e9a90c); color: #1b1408; }
.clue-chip { --fx-k: 6px; --fx-c: #4a4d5c; --fx-hi: #9aa0b8; --fx-lo: #4a4d5c; }
.clue-chip b { border-radius: 0; clip-path: polygon(5px 0,calc(100% - 5px) 0,100% 5px,100% calc(100% - 5px),calc(100% - 5px) 100%,5px 100%,0 calc(100% - 5px),0 5px); }
.clue-chip.can { --fx-c: #ffc928b0; --fx-hi: #fff1b8; --fx-lo: #ffc92880; }
.clue-chip.found { --fx-c: #8a6c33; }
@media (prefers-reduced-motion: reduce) { .plan .clue-pin.can::after { animation: none; } }

/* Keep dialog frame outside its scrollable content. */
#modal:has(> .modal-scroll),#notebook:has(> .modal-scroll){padding:0;overflow:hidden;max-height:89dvh}
#modal > .modal-scroll,#notebook > .modal-scroll{max-height:89dvh;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:24px;box-sizing:border-box}
#modal > .close,#notebook > .close{z-index:4}
#modal .modal-scroll .detail-world{max-height:none;overflow:visible}
