
#chPanel {
    background: var(--table-felt); border: 1px solid var(--table-edge); border-radius: 12px;
    padding: 16px 22px; display: flex; flex-direction: column; gap: 8px; min-width: 420px;
  }
#chPanel.readonly {
    pointer-events: none; opacity: .8;
  }
  .ch-active-ring {
    transform-box: fill-box; transform-origin: center;
    animation: chRingSpin 4s linear infinite;
  }
  @keyframes chRingSpin { to { transform: rotate(360deg); } }
  .ch-active-halo { transform-box: fill-box; transform-origin: center; animation: chHalo 1.7s ease-out infinite; }
  @keyframes chHalo {
    0%   { transform: scale(.72); opacity: .85; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
  }
@media (prefers-reduced-motion: reduce) {
    .ch-active-ring, .ch-active-halo { animation: none; }
    .ch-active-halo { display: none; }
}
  #chBoardCol { flex: 1 1 900px; min-width: 620px; display: flex; flex-direction: column; gap: 6px; position: relative; }
  #chOverBar {
    position: absolute; right: 18px; bottom: 18px; z-index: 30;
    display: none; align-items: center; gap: 10px;
    background: rgba(23,16,43,.92); border: 1px solid var(--table-edge);
    border-radius: 10px; padding: 9px 12px; box-shadow: 0 6px 22px rgba(0,0,0,.5);
  }
  #chOverBar.show { display: flex; }
  #chEndFx { position: absolute; z-index: 20; overflow: hidden; border-radius: 12px; pointer-events: none; opacity: 0; transition: opacity .6s; }
  #chEndFx.on { opacity: 1; }
  .ch-end-shade { position: absolute; inset: 0; }
  .ch-end-pulse { position: absolute; border-radius: 50%; border: 3px solid #ff2e4d; box-sizing: border-box; transform: translate(-50%, -50%); opacity: 0; }
  .ch-end-pulse.go { animation: chEndPulse .8s ease-out 2; }
  @keyframes chEndPulse { from { opacity: 1; transform: translate(-50%, -50%) scale(.6); } to { opacity: 0; transform: translate(-50%, -50%) scale(2.6); } }
  .ch-end-card { position: absolute; transform: translate(-50%, -50%); perspective: 600px; transition: width .7s cubic-bezier(.3,1.3,.6,1), height .7s cubic-bezier(.3,1.3,.6,1), left .7s ease, top .7s ease; }
  .ch-end-flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.4,0,.2,1); }
  .ch-end-card.turn .ch-end-flip { transform: rotateY(180deg); }
  .ch-end-face { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; filter: drop-shadow(0 0 10px #c9243f); }
  .ch-end-front { box-sizing: border-box; border: 3px solid #e3122f; background: #16090f; }
  .ch-end-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .ch-end-back { transform: rotateY(180deg); box-sizing: border-box; border: 5px solid #e3122f; background: #fff; }
  .ch-end-words { position: absolute; transform: translate(-50%, -100%); text-align: center; white-space: nowrap; color: #fff; text-shadow: 0 2px 10px #000; opacity: 0; transition: opacity .6s; }
  .ch-end-words.on { opacity: 1; }
  .ch-end-words b { display: block; font-family: Georgia, 'Times New Roman', serif; font-weight: 700; font-size: clamp(1.8em, 3.4vw, 3em); letter-spacing: .04em; line-height: 1.05; color: #e2b500; }
  .ch-end-words span { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: clamp(1em, 1.7vw, 1.5em); letter-spacing: .05em; }
  #chBoard.ch-end-fade [data-tok="h"] { opacity: 0; transition: opacity 1.8s; }
  #chOverBar { flex-direction: column; align-items: center; text-align: center; gap: 8px; max-width: min(620px, 92%); }
  #chOverBar .ch-over-note { order: 1; }
  .ch-over-picks { order: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; align-items: center; color: var(--ink); font-size: .85em; }
  #chOverBtn { order: 3; }
  .ch-over-picks label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
  #chOverBar .ch-over-note { color: var(--ink-dim); font-size: .82em; font-style: italic; }
  #chZoomCtl { display: flex; align-items: center; gap: 8px; }
  #chZoomCtl .btn { padding: 3px 13px; font-size: 1.15em; line-height: 1; }
  #chZoomPct { color: var(--ink-dim); font-size: .85em; min-width: 46px; text-align: center; }
  #chBoardWrap { width: 100%; overflow: auto; max-height: 86vh; border-radius: 12px; }
  #chZoomCtl .btn.on { background: var(--lamp); color: #241640; }
  #chTip { position: fixed; z-index: 50; transform: translate(-50%, -115%); background: #241640; color: #f0e9ff;
    border: 1px solid var(--purple-glow); border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 700;
    pointer-events: none; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
  #chBoard { display: block; width: 100%; height: auto; border-radius: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.5); background: #0d0a18; }
  #chSide { flex: 0 0 340px; width: 340px; display: flex; flex-direction: column; gap: 12px; max-height: 88vh; overflow: visible; }
  #chActions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    background: #241640; border: 1px solid #3a2a63; border-radius: 10px; padding: 10px 12px; }
  #chActions .ch-msg { color: var(--ink-dim); width: 100%; }
  #chBoard .ch-dest { cursor: pointer; }
  #chBoard text { pointer-events: none; }
  .ch-lit { display: block; width: 100%; color: var(--ink-dim); font-size: .85em; line-height: 1.6; }
  .ch-lit b { color: var(--ink); }
  #chHorrorCard { background: linear-gradient(180deg, #33333a 0%, #000 100%); border: 3px solid #e3122f; border-radius: 10px; padding: 12px 14px;
    color: #e8e2f5; font-size: .95em; line-height: 1.5; flex: 0 0 auto; }
  #chHorrorCard b { color: #e3122f; letter-spacing: 1px; }
  .ch-hc-title { color: #e3122f; font-weight: 800; font-size: 1.15em; letter-spacing: .5px; }
  .ch-hc-stop { color: #e3122f; font-weight: 800; text-decoration: underline dotted; cursor: pointer; }
  .ch-hc-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
  .ch-hc-btns .btn { margin: 0; width: 100%; color: var(--gold-text); border-color: #e3122f; background: linear-gradient(180deg, #33333a 0%, #000 100%); }
  .ch-hc-btns .btn:disabled { opacity: .7; filter: none; cursor: default; }
  .ch-hc-btns .btn.ch-abil.on { background: var(--lamp); color: #241640; border-color: var(--lamp); }
  .ch-lamp.ch-hrow { border-color: #e3122f; }
  .ch-wood { width: 42px; height: 42px; flex: 0 0 42px; box-sizing: border-box; border-radius: 50%; background: #16090f; border: 3px solid #e3122f; overflow: hidden; display: flex; align-items: center; justify-content: center; }
  .ch-wood img { width: 38px; height: 38px; }
  .ch-sp { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font-size: .8em; color: var(--gold-text); }
  .ch-sp .r { display: flex; gap: 3px; align-items: center; }
  .ch-sp .p { width: 9px; height: 9px; border-radius: 2px; box-sizing: border-box; border: 1px solid #fff; background: var(--gold-text); } .ch-sp .p.spent { background: transparent; }
  body[data-game="ch"] #roundLine { font-size: 1.6em; font-weight: 800; flex: 0 0 auto; }
  .ch-tkpanel { display: block; margin-top: 6px; padding: 6px 10px; border: 1px solid #6d1f2c;
    border-radius: 8px; color: var(--gold-text); }
  #chTickets { padding: 0; flex: 0 0 auto; }
  .ch-lamp { position: relative; overflow: hidden; display: flex; gap: 10px; padding: 8px 10px; align-items: center; margin-bottom: 6px;
    background: #241640; border: 1px solid #3a2a63; border-radius: 10px; }
  .ch-row-pic { position: absolute; top: 6%; right: 0; height: 108%; aspect-ratio: 1; transform: translateX(8%); border-radius: 50%; object-fit: cover; filter: grayscale(1) brightness(.5); pointer-events: none; }
  .ch-lamp-info, .ch-lamp-tk, .ch-sp, .ch-lamp-badge, .ch-wood { position: relative; z-index: 1; }
  .ch-l1 { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
  .ch-l1 .pl-id { gap: 6px; }
  .ch-gold { color: var(--gold-text); font-weight: 800; }
  .ch-lamp.act { outline: 2px solid var(--lamp); }
  .ch-lamp-badge { width: 42px; height: 42px; border-radius: 50%; font-weight: 800; font-size: 1.25em; display: flex; align-items: center; justify-content: center; flex: 0 0 42px; }
  .ch-lamp-info { flex: 1; display: flex; flex-direction: column; font-size: .85em; color: #e8e2f5; min-width: 0; }
  .ch-lamp-info span { color: var(--ink-dim); font-size: .9em; }
  .ch-lamp-tk { display: flex; flex-direction: column; gap: 3px; }
  .tk-row { display: flex; gap: 2px; }
  .tkp { width: 8px; height: 8px; border-radius: 2px; box-sizing: border-box; border: 1px solid #fff; }
  .tkp.c { background: var(--ch-crawl); } .tkp.g { background: var(--ch-corridor); } .tkp.d { background: var(--ch-express); }
  .tkp.spent { background: transparent; }
  #chLog { background: #241640; border: 1px solid #3a2a63; border-radius: 10px; padding: 10px 12px; color: #e8e2f5; flex: 1 1 auto; min-height: 110px; overflow-y: auto; }
  #chActions { flex: 0 0 auto; }
  .ch-log-title { letter-spacing: 1px; text-transform: uppercase; color: var(--gold-text); font-size: .9em; margin-bottom: 6px; }
  .ch-log-row { display: flex; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px dashed #3a2a63; font-size: .85em; }
  .ch-log-row.surf { background: rgba(201,36,63,.12); }
  .ch-log-stop { color: var(--ink-dim); }
  .ch-log-n { width: 22px; text-align: right; color: var(--ink-dim); flex: 0 0 22px; }
  .ch-chip { padding: 1px 8px; border-radius: 10px; font-size: .85em; }
  .ch-chip.chatiere { background: var(--ch-crawl-bg); color: var(--ch-crawl-fg); border: 1px dashed var(--ch-crawl); }
  .ch-chip.galerie { background: var(--ch-corridor-bg); color: var(--ch-corridor-fg); border: 1px solid var(--ch-corridor); }
  .ch-chip.deep { background: var(--ch-express-bg); color: var(--ch-express-fg); border: 1px solid var(--ch-express); }
  .ch-chip.hidden { background: #2a2038; color: var(--gold-text); border: 1px solid #d9a441; font-weight: 800; }
  .ch-abil.on { background: var(--lamp); color: #241640; border-color: var(--lamp); }
  .ch-log-at { color: #ff8f9f; font-weight: 700; }
body.ch-intro-on #chZoomCtl { display: none !important; }
  body.ch-intro-on.ch-intro-chat #chatBubble { display: block !important; z-index: 74; pointer-events: none; }
  #chIntro .ch-intro-shade { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
  #chIntro .ch-intro-dark { animation: chLampFlicker 3.2s infinite; }
  #chIntro .ch-intro-glow { animation: chLampGlow 2.3s infinite; mix-blend-mode: screen; }
  @keyframes chLampFlicker { 0%, 100% { opacity: .95; } 12% { opacity: .92; } 15% { opacity: .96; } 48% { opacity: .93; } 52% { opacity: .97; } 80% { opacity: .94; } }
  @keyframes chLampGlow { 0%, 100% { opacity: 1; } 30% { opacity: .8; } 34% { opacity: 1; } 70% { opacity: .88; } }
  .ch-intro-plate { position: fixed; left: 26px; top: 18px; z-index: 3; font-style: italic; font-size: 1.5em; letter-spacing: 3px; color: #e0bd78; text-shadow: 0 0 14px rgba(255,190,90,.55); }
  #chIntro .ch-intro-next, #chIntro .ch-intro-skip { position: fixed; right: 22px; z-index: 3; cursor: pointer; font-family: inherit; letter-spacing: 1px;
    color: #f4ecd8; background: rgba(24,16,8,.88); border: 1px solid #8a6a33; border-radius: 3px; }
  #chIntro .ch-intro-next { top: 50%; transform: translateY(-50%); font-size: 1.1em; padding: 10px 16px; }
  #chIntro .ch-intro-skip { top: 18px; font-size: .95em; padding: 6px 12px; }
  #chIntro .ch-intro-next:hover, #chIntro .ch-intro-skip:hover { border-color: var(--gold-text); color: var(--gold-text); }
  #chIntro.ch-intro-title .ch-intro-next, #chIntro.ch-intro-title .ch-intro-skip, #chIntro.ch-intro-title .ch-intro-cap { display: none; }
  .ch-intro-cap { position: fixed; left: 50%; bottom: 4vh; transform: translateX(-50%); z-index: 3; width: min(860px, 88vw); text-align: center;
    background: #f4ecd8; color: #2b2317; border: 2.5px solid #2b2317; border-radius: 2px; padding: 16px 28px 18px;
    box-shadow: inset 0 0 0 4px #f4ecd8, inset 0 0 0 5px rgba(43,35,23,.7), 0 14px 50px rgba(0,0,0,.8); animation: teIntroFade .5s both; }
  .ch-intro-cap:empty { display: none; }
  #chIntro.ch-intro-top .ch-intro-cap { bottom: auto; top: 8vh; }
  #chIntro.ch-intro-mid .ch-intro-cap { bottom: auto; top: 50%; transform: translate(-50%, -50%); }
  .ch-intro-castt { margin-top: 14px; letter-spacing: 4px; font-size: .8em; text-transform: uppercase; opacity: .75; }
  .ch-intro-cast { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 8px; font-size: 1.15em; }
  .ch-intro-cast > div { display: flex; align-items: center; gap: 8px; justify-content: center; animation: teFadeUp .45s both; }
  .ch-intro-cast img { width: 34px; height: 34px; flex: 0 0 34px; }
  .ch-intro-cast .you { margin-left: 5px; font-size: .7em; letter-spacing: 2px; text-transform: uppercase; color: #8a1c1c; }
  .ch-intro-wipe { position: fixed; inset: 0; z-index: 4; background: #050302; box-shadow: -3px 0 0 #8a6a33; pointer-events: none; animation: chIntroWipe .6s ease-in both; }
  @keyframes chIntroWipe { from { transform: translateX(0); } to { transform: translateX(101%); } }
  .ch-intro-trace { position: fixed; inset: 0; pointer-events: none; }
  .ch-intro-trace svg { display: block; }
  .ch-intro-trace .glow { animation: chIntroDraw 1s ease-out both; }
  @keyframes chIntroDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  .ch-intro-ring { position: fixed; border-radius: 50%; border: 3px solid #ffc900; box-shadow: 0 0 18px rgba(255,201,0,.7); pointer-events: none; animation: teIntroRipple 1.8s ease-out infinite; }
  .ch-intro-log { position: fixed; background: rgba(20,14,30,.97); border: 1px solid #3a2a63; border-radius: 10px; padding: 10px 12px; color: var(--ink); font-family: system-ui, sans-serif; }
  .ch-intro-log .ch-log-row { animation: teFadeUp .4s both; }
  .ch-intro-surf { position: fixed; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 4px #ff2e4d, 0 0 26px rgba(255,46,77,.8); animation: teIntroPop .5s both; transition: opacity 1.2s; }
  .ch-intro-surf img { width: 100%; height: 100%; display: block; }
  .ch-intro-surf.gone { opacity: 0; }
  .ch-intro-surf.still { box-shadow: none; }
  .ch-intro-lampchip { position: fixed; border-radius: 50%; border: 3px solid #f4c430; background: #241640; color: #fff; font: 800 13px system-ui, sans-serif;
    display: flex; align-items: center; justify-content: center; pointer-events: none; box-shadow: 0 0 16px rgba(255,201,0,.6);
    transition: left 1.3s ease-in-out, top 1.3s ease-in-out; }
  .ch-intro-catch { position: fixed; border-radius: 50%; border: 4px solid #ffc900; pointer-events: none; animation: teIntroRipple 1.2s ease-out 2 both; }
  .ch-intro-tabs { position: fixed; display: flex; gap: 4px; background: rgba(20,14,30,.97); border: 1px solid #3a2a63; border-radius: 10px; padding: 6px; font-family: system-ui, sans-serif; font-size: .85em; white-space: nowrap; }
  .ch-intro-tabs span { padding: 5px 10px; border-radius: 7px; color: var(--ink-dim); }
  .ch-intro-tabs span.on { background: var(--gold-text); color: #241640; font-weight: 700; }
  #chIntroWait .ch-iw-box { text-align: center; background: #f4ecd8; color: #2b2317; border: 2.5px solid #2b2317; padding: 22px 34px; font-family: Georgia, 'Times New Roman', serif;
    box-shadow: inset 0 0 0 4px #f4ecd8, inset 0 0 0 5px rgba(43,35,23,.7); }
  #chIntroWait .ch-iw-line { font-size: 1.5em; letter-spacing: 1px; }
#chPanel {
    width: min(960px, 94vw); max-width: min(960px, 94vw); min-width: 0; box-sizing: border-box;
    margin-left: auto; margin-right: auto;
  }
#setupBox #chPanel {
    background: none; border: 0; border-radius: 0; padding: 0; margin: 0; box-shadow: none;
    width: 100%; max-width: none; min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
  .ch-surfaced { filter: drop-shadow(0 0 7px #c9243f) drop-shadow(0 0 15px #c9243f); }
@media (max-width: 900px) {
  #chBoardCol, #chSide {
      min-width: 0;
    }
  #chPanel {
      width: 100%; max-width: 520px; padding: 14px 16px;
    }
    #chSide { width: 100%; flex: 1 1 auto; max-height: none; }
    #chBoardCol { flex: 1 1 auto; width: 100%; }
    #chSide { overflow-y: visible; }
    #chBoardWrap { max-height: 62vh; }
  #chBoardWrap {
      overflow: auto; -webkit-overflow-scrolling: touch;
      touch-action: none; overscroll-behavior: contain;
      border-radius: 12px;
    }
}
@media (pointer: coarse) {
  #chBoardWrap {
      overflow: auto; -webkit-overflow-scrolling: touch;
      touch-action: none; overscroll-behavior: contain;
      border-radius: 12px;
    }
}
@media (max-height: 500px) and (orientation: landscape) {
  #chBoardWrap { max-height: 78vh; }
    #chBoardCol { flex: 1 1 auto; width: auto; min-width: 0; }
    #chSide { flex: 0 0 300px; width: 300px; max-height: 78vh; overflow: visible; }
    #chBoardWrap { max-height: 60vh; }
}
  .ch-join { color: var(--gold-text); text-align: center; line-height: 1.1; }
  .ch-join span { display: block; }
  .ch-join-big { font-family: Georgia, 'Times New Roman', serif; font-size: 2.8em; letter-spacing: .03em; }
  .ch-join-by { font-size: .85em; font-style: italic; margin-top: 6px; }
  .ch-join-tspg { font-size: 1.35em; font-weight: 700; letter-spacing: 1px; margin-top: 4px; }

  #chArea { display: none; flex-direction: row; flex-wrap: wrap; gap: 14px; padding: 8px 14px 20px;
    max-width: 1860px; margin: 0 auto; align-items: flex-start; }
  body.ch-intro-on #rulesDrawer, body.ch-intro-on #flashToast, body.ch-intro-on #chatBubble { display: none !important; }
  #chIntro { position: fixed; inset: 0; z-index: 72; overflow: hidden; color: #2b2317; user-select: none; cursor: pointer; font-family: Georgia, 'Times New Roman', serif; }
  #chIntro .ch-intro-stage { position: absolute; inset: 0; }
  #chIntro .ch-intro-black { position: absolute; inset: 0; background: #050302; }
  .ch-intro-big { font-size: clamp(1.3em, 2.4vw, 2.1em); letter-spacing: 1.5px; line-height: 1.2; }
  .ch-intro-exp { margin-top: 10px; font-size: 1.2em; line-height: 1.4; }
  .ch-intro-exp:empty { display: none; }
  #chIntroWait { position: fixed; inset: 0; z-index: 72; background: rgba(5,3,2,.94); display: flex; align-items: center; justify-content: center; }
  #chIntroWait .btn { margin-top: 16px; }
@media (max-width: 900px) {
  #chArea { flex-direction: column; align-items: stretch; padding-left: 6px; padding-right: 6px; padding-bottom: 78px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #chArea { flex-direction: row; flex-wrap: nowrap; align-items: flex-start; padding-left: 6px; padding-right: 6px; padding-bottom: 60px; }
}
