:root {
  color-scheme: dark;
  --ink: #1c1b1d;
  --panel: #2a292c;
  --line: #57535b;
  --paper: #f1ede6;
  --dim: #b8b2b6;
  --red: #c23b2d;
  --green: #7cc596;
  background: var(--ink);
  color: var(--paper);
  font: 16px/1.6 "Malgun Gothic", sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.3;
}

a {
  color: inherit;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

input,
textarea,
select,
button,
.button {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: inherit;
  font: inherit;
}

button,
.button {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  filter: brightness(1.12);
}

.inside > header .button {
  padding: 0.2rem 0.8rem;
}

button.quiet {
  padding: 0.2rem 0.6rem;
  border-color: var(--line);
  background: none;
  color: inherit;
  font-weight: 400;
}

.name {
  field-sizing: content;
  min-width: 2rem;
  max-width: 100%;
  padding: 0.3rem;
  border: 0;
  background: none;
  font-weight: 700;
  text-overflow: ellipsis;
}

.name:hover {
  background: var(--line);
}

.icon {
  display: grid;
  place-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.icon input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.icon svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: var(--dim);
}

.icon:hover svg {
  fill: var(--paper);
}

:focus-visible,
.icon:focus-within {
  outline: 2px solid var(--paper);
  outline-offset: 2px;
}

#error {
  min-height: 1.6em;
  margin: 0;
  color: #ffa093;
}

#code {
  letter-spacing: 0.06em;
}

#offline {
  margin: 0;
  padding: 0.5rem 1.5rem;
  background: var(--red);
  color: #fff;
}

.notice {
  display: grid;
  place-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

/* 초대 링크를 열면 나오는 화면 */

#backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.25;
}

.gate {
  display: grid;
  grid-template-columns: auto 20rem;
  gap: 2.5rem;
  place-content: center;
  align-items: center;
  min-height: 100vh;
}

.gate h1 {
  max-height: 80vh;
  padding-right: 1.5rem;
  border-right: 3px solid var(--red);
  font-family: "Noto Serif KR", Batang, serif;
  font-size: 2.5rem;
  letter-spacing: 0.15em;
  writing-mode: vertical-rl;
}

.gate form {
  display: grid;
  gap: 0.4rem;
}

/* GM의 방 목록 */

.lobby {
  padding: 1rem 1rem 6rem;
}

.lobby h1 {
  font-size: 1.2rem;
}

#add {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 4rem;
  height: 4rem;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
  font-size: 2.2rem;
  font-weight: 400;
  line-height: 1;
}

#rooms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(25rem, 100%), 1fr));
  gap: 1rem;
}

#rooms li {
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr auto auto auto;
  gap: 0 0.3rem;
  align-items: center;
  overflow: hidden;
  border-radius: 4px;
  background: var(--panel);
}

.cover {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 9;
}

/* 그림이 없는 방과 장면: 밤하늘의 붉은 달 */
.cover,
#board:has(#scene:empty) {
  background:
    radial-gradient(circle at 68% 42%, var(--red) 0 4.4rem, transparent 4.5rem),
    linear-gradient(#37343c, #171619);
}

.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#rooms .name {
  margin: 0.3rem 0 0.3rem 0.3rem;
}

#rooms time,
#empty,
#trash {
  color: var(--dim);
}

#rooms time {
  font-size: 0.85rem;
  white-space: nowrap;
}

#trash {
  margin-top: 1.5rem;
}

#trash summary {
  cursor: pointer;
}

#trash li {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.4rem 0;
}

/* 방 안: 준비 화면과 게임 화면 */

.inside {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.inside > header,
.inside > footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.2rem;
  align-items: center;
  min-height: 3rem;
  padding: 0.3rem 0.8rem;
}

.inside p {
  margin: 0;
}

.inside #error {
  overflow-y: auto;
  max-height: 3.2em; /* 두 줄 */
}

.inside h1,
.inside h2 {
  font-size: 1rem;
}

.push {
  margin-left: auto;
}

.inside > main {
  display: grid;
  flex: 1;
  gap: 0.5rem;
  min-height: 0;
  padding: 0 0.5rem;
}

.inside section {
  overflow-y: auto;
  scroll-padding-top: 2.6rem;
  border-radius: 4px;
  background: var(--panel);
}

.inside section header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.6rem;
  padding: 0 0.5rem 0 0.8rem;
}

.inside section > header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: inherit;
}

#people {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
}

#people small {
  display: none;
}

#people li {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  color: var(--dim);
}

#people li::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border: 1px solid var(--dim);
  border-radius: 50%;
}

#people .online {
  color: inherit;
}

#people .online::before {
  border-color: var(--green);
  background: var(--green);
}

/* 게임 화면 */

.play > main {
  grid-template-columns: minmax(0, 17.5fr) minmax(0, 52fr) minmax(0, 17.5fr); /* 2026-12-06에 가운데 그림을 키웠다 */
  padding-block: 0 0.5rem; /* 위쪽 줄 바로 아래부터 화면 아래 끝까지 쓴다 */
}

/* 오른쪽 버튼 줄은 버튼이 있는 사람에게만 생긴다 */
.play > main:has(#bar) {
  grid-template-columns: minmax(0, 17.5fr) minmax(0, 52fr) minmax(0, 17.5fr) auto;
}

/* 오른쪽 버튼 줄로 여는 칸(핸드아웃, GM 메뉴)은 채팅 칸 위에 덮어서 연다. 자리를 정해 두어야 칸이 밀리지 않는다. */
#cast { grid-area: 1 / 1; }
#stage { grid-area: 1 / 2; }
#chat,
.panel { grid-area: 1 / 3; }
#bar { grid-area: 1 / 4; }

.play > header label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.play #people {
  padding: 0.6rem 0.8rem;
}

/* 가운데. 위에는 장면 그림, 그 바로 아래에는 대사 창 자리를 늘 남겨 둔다. */
#stage {
  --talk-room: 11rem; /* 대사 창 최소 높이 */
  --head-room: 4.6rem; /* 그림 위의 「메인 화면」과 행동 표시 자리 */
  --board-width: min(100cqw, (100cqh - var(--talk-room) - var(--head-room)) * 16 / 9);
  container-type: size;
  position: relative;
  display: grid;
  /* 위에서부터 「메인 화면」과 행동 표시, 장면 그림, 대사 창. 대사 창은 그림 아래 남는 자리의 절반 높이다(짧아도 8.5rem).
     남는 자리는 맨 위 칸이 가진다(2026-12-06). */
  grid-template-rows: var(--head-room) auto minmax(var(--talk-room), 1fr);
  align-content: start; /* 위 빈자리 없이 맨 위부터 채우고, 남는 높이는 모두 대사 창이 가진다(2026-12-06 사용자 요청) */
  justify-content: center;
  overflow: hidden;
}

/* 장면 그림 위: 「메인 화면」 글자와 PC마다 행동/미행동 */
#stage-head {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 0.35rem;
  width: var(--board-width);
  padding-bottom: 0.35rem;
  box-sizing: border-box;
}

#stage-head h2 {
  margin: 0;
  padding: 0.15rem;
  border: 1px solid #5a5560;
  background: linear-gradient(#3a363f, #26232a);
  font-size: 1rem;
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.1em;
}

#acted {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

#acted button {
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
  padding: 0.2rem 0.7rem;
  border: 1px solid #8a7a50;
  border-radius: 999px;
  background: #3b3424;
  color: #ffe9a8;
  cursor: pointer;
}

#acted button span {
  font-size: 0.85rem;
}

/* 행동을 마친 PC는 어둡게 */
#acted button.done {
  border-color: var(--line);
  background: #222026;
  color: var(--dim);
}

#acted button.done span::before {
  content: "✓ ";
}

#acted .reset {
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
}

/* GM의 소리 목록 */
#cue-pick {
  position: fixed;
  inset: 3rem 1rem auto auto;
  margin: 0;
  width: 18rem;
  max-height: 70vh;
  overflow: auto;
  padding: 0.5rem;
}

#cue-pick b {
  display: block;
  margin-bottom: 0.3rem;
}

/* 소리 목록 한 줄: 왼쪽에 누르는 버튼, 오른쪽에 소리 이름 */
#cue-pick .cue {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.3rem;
}

#cue-pick .cue button {
  flex: none;
  width: 2.2rem;
  padding: 0.25rem 0;
}

#cue-pick .cue span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 모두의 화면에서 그림과 캐릭터 자리가 같도록 늘 16:9다 */
#board {
  position: relative;
  overflow: hidden;
  width: var(--board-width);
  aspect-ratio: 16 / 9;
}

.layer {
  position: absolute;
  inset: 0;
  background: center / cover;
  pointer-events: none;
}

.layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.layer.tall img {
  object-fit: contain;
  backdrop-filter: blur(20px) brightness(0.5);
}

/* 대사 창. 장면 그림 바로 아래에 메인챗의 말이 나오고, 말한 캐릭터의 그림이 창 왼쪽 위에 선다. */
#talkbox {
  position: relative;
  z-index: 5;
  width: var(--board-width);
  pointer-events: none;
}

#talkbox[hidden] {
  display: block;
  visibility: hidden;
}

#stand {
  position: absolute;
  left: 2%;
  bottom: 100%; /* 장면 그림의 왼쪽 아래에 선다. 대사 창의 이름을 가리지 않는다. */
  max-width: 30%;
  height: min(16rem, 62cqh);
  object-fit: contain;
  object-position: bottom left;
  filter: drop-shadow(0 0.3rem 0.8rem rgb(0 0 0 / 0.6));
}

#talkbox .box {
  position: relative;
  height: 100%;
  overflow: auto;
  padding: 0.6rem 1rem 0.9rem;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-top: 0;
  border-radius: 0 0 4px 4px;
  background: rgb(20 20 22 / 0.88);
  pointer-events: auto;
}

/* 이름과 ▸, ✕는 글이 길어 스크롤해도 늘 위에 보인다 */
#talkbox header {
  position: sticky;
  top: -0.6rem;
  z-index: 1;
  margin: -0.6rem -1rem 0;
  padding: 0.6rem 1rem 0;
  background: rgb(20 20 22);
  display: flex;
  gap: 0.3rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

#speaker {
  flex: 1;
  font-size: 0.95rem;
}

#talkbox header button {
  padding: 0 0.35rem;
  border: 0;
  background: none;
  font-size: 1.1rem;
  line-height: 1.4;
}

#line {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

#line.art {
  padding-left: 0.6rem;
  border-left: 3px solid var(--art);
}

/* 캐릭터 */

.piece {
  position: absolute;
  display: grid;
  width: calc(11% * var(--size, 1));
  translate: -50% -50%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition:
    left 0.2s,
    top 0.2s;
}

.piece.held {
  visibility: hidden;
  transition: none;
}

.piece.ghost {
  position: fixed;
  z-index: 3;
  pointer-events: none;
  transition: none;
}

.piece.secret {
  opacity: 0.45;
}

.piece > * {
  width: 100%;
  rotate: var(--angle);
  transition: rotate 0.2s;
}

.piece span {
  display: grid;
  place-content: center;
  aspect-ratio: 1;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--red);
  font-size: 2.2rem;
  font-weight: 700;
}

#about,
#menu,
#control,
#paste {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ink);
  color: inherit;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
}

#about {
  position: fixed;
  z-index: 2;
  overflow: hidden;
  max-width: 24rem;
  max-height: 80vh;
  padding: 0.5rem 0.8rem;
  white-space: pre-wrap;
  pointer-events: none;
}

#about b {
  display: block;
}

#menu {
  position: fixed;
  margin: 0;
  padding: 0.3rem 0;
}

#menu button {
  display: block;
  width: 100%;
  padding: 0.3rem 1rem;
  border: 0;
  border-radius: 0;
  background: none;
  font-weight: 400;
  text-align: left;
}

#menu button:hover {
  background: var(--line);
}

#menu label {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.3rem 1rem;
}

#menu label input {
  flex: 1;
  width: 0;
  padding: 0;
}

/* 넣어 둔 캐릭터 이미지 */
#menu div {
  display: grid;
  grid-template-columns: repeat(4, 3.2rem);
  gap: 0.3rem;
  padding: 0.3rem 1rem;
}

#menu span {
  position: relative;
}

#menu span button {
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: top / cover;
}

#menu span .now {
  border-color: var(--red);
}

#menu span button + button {
  position: absolute;
  top: 0;
  right: 0;
  width: 1.2rem;
  border: 0;
  background: rgb(0 0 0 / 0.75);
  font-size: 0.7rem;
  text-align: center;
  opacity: 0;
}

#menu span:hover button + button,
#menu button + button:focus-visible {
  opacity: 1;
}

#menu div > button {
  grid-column: 1 / -1;
  padding: 0.2rem 0;
}

#paste {
  padding: 1rem;
}

#paste textarea {
  width: 100%;
  margin-top: 0.6rem;
  resize: none;
}

#cast {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#cast > div {
  flex: 1;
  overflow-y: auto;
}

/* 넓으면 두 명씩 놓는다 */
#status {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.2rem, 1fr));
  gap: 0 0.5rem;
  padding: 0 0.5rem;
}

/* 왼쪽은 그림, 오른쪽은 2칸씩 4줄. 아래는 나중에 변조와 디버프를 넣을 자리다 */
#status li {
  position: relative;
  display: grid;
  grid-template-columns: 2.6rem 1fr 1fr;
  gap: 0.15rem;
  align-content: start;
  padding: 0.5rem 0 1.1rem;
  font-size: 0.7rem;
  line-height: 1.25;
}

#status .secret {
  opacity: 0.45;
}

.home {
  grid-row: 1 / span 4;
  align-self: start;
  overflow: hidden;
  width: 2.4rem;
  aspect-ratio: 1;
  border: 1px solid var(--paper);
  border-radius: 4px;
  background: #000;
  cursor: grab;
  user-select: none;
}

.home.away > * {
  opacity: 0.35; /* 지금은 장면에 나가 있다 */
}

.home > * {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.home span {
  display: grid;
  place-content: center;
  background: var(--red);
  font-size: 1.2rem;
  font-weight: 700;
}

/* 이니셔티브 */
#status b {
  position: absolute;
  top: 0.1rem;
  left: 1.7rem;
  min-width: 1.15rem;
  border-radius: 1rem;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  pointer-events: none;
}

/* 남은 만큼 하얗게 찬다 */
#status button {
  display: flex;
  justify-content: space-between;
  padding: 0 0.2rem;
  border: 0;
  border-radius: 0;
  background: linear-gradient(var(--paper), var(--paper)) 0 / var(--full) 100% no-repeat #99949a;
  color: var(--ink);
  font-weight: 400;
  white-space: nowrap;
}

#status i,
#control i {
  font-style: normal;
}

#status .low {
  color: #b0002c;
  font-weight: 700;
}

#control {
  position: fixed;
  margin: 0;
  padding: 0.6rem 0.8rem;
}

#control div {
  display: grid;
  grid-template-columns: 2.5rem 6rem 2.6rem 2rem 2rem;
  gap: 0.3rem;
  align-items: center;
}

#control meter {
  width: 100%;
  height: 1rem;
  appearance: none;
}

#control ::-webkit-meter-bar {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #66616a;
}

#control ::-webkit-meter-optimum-value {
  background: var(--paper);
}

#control span {
  text-align: right;
}

#control .low {
  color: #ff8f86;
  font-weight: 700;
}

#control button {
  padding: 0.2rem 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: 0.8rem;
}

#control button:hover {
  background: var(--line);
}

#mine {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.3rem 0.4rem;
  border-top: 2px solid var(--red);
}

#mine:empty {
  display: none;
}

#mine button {
  padding: 0.05rem 0.5rem;
  border-color: var(--line);
  background: none;
  font-size: 0.8rem;
  font-weight: 400;
}

#mine [aria-pressed="true"] {
  background: var(--red);
}

/* 내 인법은 늘 맨 아래에 있다 */
#arts {
  display: block;
  flex: none;
  overflow-y: auto;
  max-height: 45%;
  padding: 0 0.4rem 0.3rem;
  border-spacing: 0;
  font-size: 0.75rem;
  line-height: 1.3;
}

#arts th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--dim);
  font-weight: 400;
}

#arts th,
#arts td {
  padding: 0.12rem 0.25rem;
  text-align: center;
  white-space: nowrap;
}

#arts :first-child:is(th, td) {
  width: 100%;
  text-align: left;
  white-space: normal;
}

#arts tbody tr {
  cursor: pointer;
}

#arts tbody tr:hover {
  background: var(--line);
}

#blocked {
  position: absolute;
  inset: auto 0 0;
  padding: 0.5rem;
  background: rgb(0 0 0 / 0.75);
  text-align: center;
}

/* 채팅 위에 덮어서 여는 칸 */
.panel {
  z-index: 2;
  display: grid;
  align-content: start;
  gap: 0.3rem;
  padding: 0.5rem 0;
  overflow: auto;
  box-shadow: 0 0 0 1px var(--line), 0 0.5rem 1.5rem rgb(0 0 0 / 0.5);
}

/* 핸드아웃 현황표 */
#handouts > h2,
#prizes > h2 {
  margin: 0 0.5rem;
  padding: 0.25rem;
  border-radius: 3px;
  background: var(--line);
  text-align: center;
  letter-spacing: 0.1em;
}

#handout-table {
  margin: 0.3rem 0.5rem 0;
  border-collapse: collapse;
  table-layout: fixed;
  width: calc(100% - 1rem);
}

#handout-table caption {
  padding: 1rem 0.5rem;
  color: var(--dim);
  caption-side: bottom;
}

#handout-table :is(th, td) {
  height: 3.2rem;
  padding: 0;
  border: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

#handout-table th {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-variant-numeric: lining-nums;
  font-weight: 400;
  background: rgb(0 0 0 / 0.25);
}

#handout-table thead th {
  height: 2.4rem;
}

#handout-table .row-name {
  position: relative;
  overflow: hidden;
  background: center / cover rgb(0 0 0 / 0.25);
}

/* 그림이 있으면 이름 글씨는 보이지 않게 한다(마우스를 올리면 설명 창에 이름이 나온다) */
#handout-table .row-name.has-image span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

#handout-table td img {
  display: block;
  width: min(2.6rem, 90%);
  margin: auto;
}

/* 자기 핸드아웃 칸은 ✕ */
#handout-table .self {
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), var(--dim) 50%, transparent calc(50% + 1px)),
    linear-gradient(to bottom right, transparent calc(50% - 1px), var(--dim) 50%, transparent calc(50% + 1px));
}

#handout-table .can-mark {
  cursor: pointer;
}

#handout-table .can-mark:is(:hover, :focus-visible) {
  outline: 2px solid var(--paper);
  outline-offset: -2px;
  background: rgb(255 255 255 / 0.08);
}

#handouts .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.4rem;
  align-items: center;
  justify-content: center;
  margin: 0.3rem 0.5rem 0;
  color: var(--dim);
  font-size: 0.85rem;
}

#handouts .legend img {
  width: 1.2rem;
}

/* GM이 표의 칸을 누르면 나오는 고르기 창 */
#mark {
  position: fixed;
  inset: auto;
  margin: 0;
  display: none;
  gap: 0.2rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ink);
  color: inherit;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
}

#mark:popover-open {
  display: flex;
}

#mark button {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  min-width: 3.2rem;
  padding: 0.3rem;
  font-size: 0.8rem;
}

#mark button img {
  width: 2rem;
}

#mark button:first-child::before {
  content: "";
  width: 2rem;
  height: 2rem;
  border: 1px dashed var(--dim);
}

#mark [aria-pressed="true"] {
  background: var(--line);
}

/* GM에게만 보이는 메뉴 */

/* 오른쪽 버튼 줄 */
#bar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.4rem;
  border-radius: 4px;
  background: var(--panel);
}

#bar button {
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  padding: 0.4rem 0.3rem;
  font-size: 0.8rem;
}

#bar button span {
  font-size: 1.3rem;
}

#bar button img {
  width: 1.7rem;
}

/* 「장면」은 버튼이 늘어나도 늘 맨 아래에 있다 */
#open-gm {
  margin-top: auto;
}

#bar [aria-expanded="true"] {
  background: var(--line);
}

#gm > :not(nav) {
  margin: 0 0.5rem;
  padding: 0.2rem;
  text-align: center;
}

#gm small {
  color: var(--dim);
  font-weight: 400;
}

#scenes h2 {
  padding: 0.8rem 0.5rem 0.2rem;
}

#scenes button {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  width: 100%;
  padding: 0.25rem 0.5rem;
  border: 0;
  border-radius: 0;
  background: none;
  font-weight: 400;
  line-height: 1.25;
  text-align: left;
}

#scenes button:hover {
  background: var(--line);
}

#scenes .now {
  background: var(--red);
}

#scenes b {
  width: 1.3rem;
  text-align: center;
}

#scenes b:empty {
  display: none;
}

#scenes .picture {
  width: 2.6rem;
}

#chat {
  display: flex;
  flex-direction: column;
}

#chat header {
  gap: 0.5rem;
  padding-left: 0.5rem;
}

#chat header button {
  position: relative;
  flex: 1;
  padding: 0.2rem;
  border-color: var(--line);
  background: none;
}

#chat header [aria-pressed="true"] {
  background: var(--line);
}

/* 안 본 새 채팅이 있는 쪽의 빨간 원 */
#chat .new::after {
  content: "";
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: #ff3b30;
}

/* 거꾸로 쌓으면 새 채팅이 올 때 맨 아래가 보인다 */
#chat div {
  display: flex;
  flex: 1;
  flex-direction: column-reverse;
  overflow-y: auto;
}

#chat li {
  padding: 0.3rem 0.8rem;
  white-space: pre-wrap;
}

/* 말하는 캐릭터의 이미지 */
#chat li:has(img) {
  position: relative;
  min-height: 3.6rem;
  padding-left: 4.3rem;
}

#chat img {
  position: absolute;
  left: 0.8rem;
  width: 3rem;
  height: 3rem;
  border-radius: 4px;
  object-fit: cover;
  object-position: top;
}

#chat b {
  display: block;
  color: var(--dim);
  font-size: 0.85rem;
}

/* 장면의 출력 글 */
#chat li.scene {
  margin: 0.5rem 0.8rem;
  padding: 0 0.7rem;
  border-left: 3px solid var(--red);
}

/* 인법. 공격은 빨강, 서포트는 파랑, 장비는 노랑이다. */
#chat li.art {
  border-left: 3px solid var(--art);
}

:is(#chat, #talkbox) .attack {
  --art: #ef6b5c;
}

:is(#chat, #talkbox) .support {
  --art: #6aa9ff;
}

:is(#chat, #talkbox) .gear {
  --art: #e8c547;
}

:is(#chat, #talkbox) strong:is(.attack, .support, .gear) {
  color: var(--art);
}

/* 채팅의 지정특기. 누르면 내 캐릭터의 목표치로 판정을 적어 준다 */
:is(#chat, #talkbox) .skill-roll {
  padding: 0;
  border: 0;
  border-bottom: 1px dashed currentColor;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

:is(#chat, #talkbox) .skill-roll:hover {
  color: var(--paper);
  border-bottom-style: solid;
  background: rgb(255 255 255 / 0.12);
}

/* 주사위 결과 */
:is(#chat, #talkbox) .dice {
  display: block;
  font-weight: bold;
}

:is(#chat, #talkbox) .dice::before {
  content: "🎲 ";
}

:is(#chat, #talkbox) .good {
  color: var(--green);
}

:is(#chat, #talkbox) .bad {
  color: #ef6b5c;
}

/* 채팅 칸 바로 위의 자주 쓰는 주사위. 위의 줄로 채팅과 나눈다. */
#quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.5rem 0.5rem 0;
  border-top: 1px solid var(--line);
}

#quick button {
  padding: 0.15rem 0.45rem;
  font-size: 0.9rem;
}

/* 글이 길어지면 칸이 채팅 칸의 절반까지 늘어나고, 그 뒤로는 스크롤바가 생긴다 */
#say {
  field-sizing: content;
  flex-shrink: 0;
  min-height: 3.2rem;
  max-height: 50%;
  overflow-y: auto;
  margin: 0.5rem;
  resize: none;
}

/* GM이 방을 준비하는 화면 */

.prepare > main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
}

/* 왼쪽과 오른쪽은 위아래 두 칸이다. 칸마다 따로 휠로 넘긴다. */
.prepare > main > div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}

.prepare div > section {
  flex: 2;
}

.prepare div > section:has(#image) {
  flex: 3;
}

.prepare div > section.room-effects {
  flex: 0 1 auto;
}

.hint {
  padding: 0.8rem;
  color: var(--dim);
}

ul:has(> :not([hidden])) + .hint {
  display: none;
}

.inside section header small {
  color: var(--dim);
}

/* 파일을 끌어오는 동안 화면을 덮는 안내 */
#drop {
  position: fixed;
  inset: 0.5rem;
  z-index: 2;
  display: grid;
  place-content: center;
  border: 3px dashed var(--paper);
  border-radius: 4px;
  background: rgb(0 0 0 / 0.8);
  font-size: 1.5rem;
  pointer-events: none;
}

/* 장면 한 칸 */

.scene {
  position: relative;
  border-top: 1px solid var(--line);
}

.scene .delete {
  position: absolute;
  top: 0.1rem;
  right: 0.4rem;
}

.scene summary {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.2rem 3rem 0.2rem 0.8rem;
  line-height: 1.25;
  cursor: pointer;
}

.scene summary:focus-visible {
  outline-offset: -2px;
}

.scene summary:hover,
.scene details[open] {
  background: var(--ink);
}

.scene b {
  flex: none;
  width: 1.6rem;
  font-size: 1.2rem;
  text-align: center;
}

.scene b:empty {
  display: none;
}

.scene summary span {
  min-width: 0;
}

.scene small {
  display: block;
  color: var(--dim);
}

.scene small,
.audio {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#change .scene {
  border: 0;
}

#change details {
  background: none;
}

/* 아직 정하지 않은 칸에 나오는 안내 */
[data-empty]:empty:not([style*="url"])::before {
  content: attr(data-empty);
  color: var(--dim);
  font-weight: 400;
}

.picture {
  flex: none;
  width: 4rem;
  aspect-ratio: 16 / 9;
  border-radius: 2px;
  background: var(--line) center / cover;
}

.fields {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem 0.9rem;
  align-items: center;
  padding: 0.4rem 0.8rem 0.9rem;
}

.fields label {
  display: contents;
}

.fields p {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.fields button {
  flex: none;
}

.fields .image {
  display: grid;
  place-items: center;
  width: 12rem;
  padding: 0.5rem;
  text-align: center;
}

.fields textarea {
  field-sizing: content;
  min-height: 5rem;
  max-height: 20rem;
  resize: none;
}

/* 미리 넣어 둔 이미지와 음악 */

.pick {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 400;
  text-align: left;
}

#image {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.4rem;
  padding: 0 0.8rem 0.8rem;
}

#image li {
  position: relative;
}

#image .pick,
#image img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 2px;
  object-fit: cover;
}

/* 마우스를 올리면 나오는 이미지 이름 */
#image span {
  position: absolute;
  inset: auto 0 0;
  overflow: hidden;
  max-height: 100%;
  padding: 0.1rem 0.4rem;
  background: rgb(0 0 0 / 0.75);
  font-size: 0.85rem;
  line-height: 1.35;
  opacity: 0;
}

#image li:hover span,
#image :focus-visible span {
  opacity: 1;
}

#image .delete {
  position: absolute;
  top: 0;
  right: 0;
  width: 1.8rem;
  height: 1.8rem;
  background: rgb(0 0 0 / 0.65);
}

#audio li {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.2rem 0.4rem 0 0.8rem;
}

#audio .pick {
  flex: 1;
}

/* 캐릭터 시트. 캐릭터를 한 번 누르면 화면 가운데에 나온다. */
#sheet {
  width: min(78rem, 96vw);
  max-height: 92vh;
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ink);
  color: inherit;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.6);
}

#sheet::backdrop {
  background: rgb(0 0 0 / 0.45);
}

#sheet > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

#sheet h2 {
  font-size: 1.3rem;
}

#sheet h3 {
  margin: 0 0 0.4rem;
  padding: 0.3rem;
  background: var(--line);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.3em;
}

#sheet .top,
#sheet .bottom {
  display: grid;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
}

#sheet .top {
  grid-template-columns: 11rem 15rem minmax(0, 1fr);
  align-items: start;
}

#sheet .top > .note {
  grid-column: 2 / -1;
}

#sheet .bottom {
  grid-template-columns: 15rem minmax(0, 1fr);
  align-items: start;
}

#sheet .face {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 4px;
  background: #000;
  font-size: 4rem;
  font-weight: 700;
}

#sheet .face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#sheet dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  margin: 0;
}

#sheet .top > dl dt,
#sheet .top > dl dd {
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

#sheet .top > dl dt {
  background: var(--panel);
  color: var(--dim);
  font-size: 0.85rem;
  white-space: nowrap;
}

#sheet .top > dl dd {
  white-space: pre-wrap;
}

#sheet .note {
  padding: 1rem;
  color: var(--dim);
}

/* 특기표. 메워진 갭은 검게 칠한다. */
#sheet .skills {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
}

#sheet .skills col.number {
  width: 2rem;
}

#sheet .skills col.value {
  width: 1.9rem;
}

#sheet .skills col.gap {
  width: 0.45rem;
}

#sheet .skills th,
#sheet .skills td {
  overflow: hidden;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--line);
  white-space: nowrap;
  text-overflow: ellipsis;
}

#sheet .skills thead th {
  background: var(--panel);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
}

#sheet .skills tbody th {
  color: var(--dim);
}

#sheet .skills td.value {
  padding-inline: 0;
  font-weight: 700;
  text-align: center;
}

/* 쓸 수 있는 분야는 하얀 칸, 습득한 특기는 분홍 칸에 ✔. 못 쓰는 분야(■)는 회색이다(엑셀 시트처럼 차이가 확 나게). */
#sheet .skills tbody td:not(.gap) {
  border-color: #c9c2ba;
  background: var(--paper);
  color: var(--ink);
}

#sheet .skills tbody td.have {
  background: #f2b5b0;
  color: #7a0f12;
  font-weight: 700;
}

#sheet .skills td.name.have::before {
  content: "✔ ";
  color: var(--red);
}

/* 갭. 메워진 갭은 밝게 칠한다. */
#sheet .skills .gap {
  padding: 0;
  border-color: transparent;
}

#sheet .skills .gap.filled {
  background: var(--dim);
}

#sheet .skill-box p {
  margin-top: 0.3rem;
  color: var(--dim);
  font-size: 0.85rem;
}

#sheet .bottom > section > p {
  padding: 0.3rem 0.5rem;
  white-space: pre-wrap;
}

/* 인법 카드. 공격은 빨강, 서포트는 파랑, 장비는 노랑, 오의는 보라. */
#sheet .cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.6rem;
}

#sheet .card {
  --art: var(--line);
  border: 2px solid var(--art);
  border-radius: 4px;
  background: var(--panel);
}

#sheet .card.attack {
  --art: #c23b2d;
}

#sheet .card.support {
  --art: #2f6fd1;
}

#sheet .card.gear {
  --art: #c9a227;
}

#sheet .card.ougi {
  --art: #8e44ad;
}

#sheet .card h4 {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  padding: 0.35rem 0.6rem;
  background: var(--art);
  color: #fff;
  font-size: 1rem;
}

#sheet .card dl {
  grid-template-columns: auto 1fr auto 1fr;
  font-size: 0.85rem;
}

#sheet .card dt,
#sheet .card dd {
  margin: 0;
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

#sheet .card dt {
  color: var(--dim);
  font-weight: 700;
}

#sheet .card dd {
  font-weight: 700;
}

#sheet .card > span {
  display: block;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* 시트에서 고치는 칸. 평소에는 글처럼 보이고, 마우스를 올리거나 적을 때만 테두리가 보인다. */
#sheet input:not([type="checkbox"]),
#sheet textarea,
#sheet select {
  width: 100%;
  min-width: 0;
  padding: 0.1rem 0.25rem;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
}

#sheet input:not([type="checkbox"]):hover,
#sheet textarea:hover,
#sheet select:hover {
  border-color: var(--line);
}

#sheet input:not([type="checkbox"]):focus,
#sheet textarea:focus,
#sheet select:focus {
  border-color: var(--dim);
  outline: none;
  background: rgb(0 0 0 / 0.35);
}

#sheet select option {
  background: var(--ink);
}

/* 유파, 하위유파처럼 목록에서 고르는 칸. 브라우저가 붙이는 화살표 대신, 고르기 칸과 같은 화살표 하나를 늘 보여 준다. */
#sheet input[list]::-webkit-calendar-picker-indicator {
  display: block;
  width: 0.75rem;
  height: 0.75rem;
  padding: 0;
  margin-right: 0.15rem;
  opacity: 1;
  color: transparent;
  cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23f1ede6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

#sheet textarea {
  field-sizing: content;
  min-height: 2.2rem;
  resize: none;
}

#sheet h2 input {
  font-size: 1.3rem;
  font-weight: 700;
}

#sheet .top > dl dd {
  padding: 0.15rem 0.3rem;
}

#sheet .bottom > section > textarea {
  min-height: 6rem;
}

/* 특기표를 누르는 곳 */
#sheet .skills td.name,
#sheet .skills thead th,
#sheet .skills .gap.manual {
  cursor: pointer;
}

#sheet .skills td.name:hover {
  outline: 1px solid var(--dim);
  outline-offset: -1px;
}

#sheet .skills .gap.manual {
  border: 1px dashed var(--line);
}

#sheet .switches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
}

#sheet .switches label {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  cursor: pointer;
}

/* 인법과 오의 카드 안의 칸 */
#sheet .card h4 {
  align-items: center;
}

#sheet .card h4 input {
  flex: 1;
  font-weight: 700;
}

#sheet .card h4 select,
#sheet .card h4 > span {
  flex: none;
  width: auto;
}

#sheet .card h4 button {
  flex: none;
  padding: 0 0.4rem;
  border-color: transparent;
  color: #fff;
}

#sheet .card dd input {
  font-weight: 700;
}

#sheet .card textarea {
  display: block;
  width: calc(100% - 0.8rem);
  margin: 0.3rem 0.4rem;
  font-size: 0.85rem;
}

#sheet .cards .add {
  min-height: 3rem;
  border-style: dashed;
  color: var(--dim);
}

#sheet .card.note {
  padding: 1rem;
}

/* 핸드아웃 설명 (줄 이름에 마우스를 올리면 나온다) */
#handout-tip {
  position: fixed;
  z-index: 10;
  width: 16rem;
  max-height: 70vh;
  overflow: hidden;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ink);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
  pointer-events: none;
}

/* 비밀 칸을 눌러 붙여 둔 창: 마우스로 스크롤할 수 있다 */
#handout-tip.pinned {
  overflow: auto;
  pointer-events: auto;
  border-color: var(--paper);
}

#handout-tip img {
  display: block;
  width: 100%;
  max-height: 14rem;
  margin-bottom: 0.4rem;
  object-fit: cover;
  object-position: top;
}

#handout-tip p {
  margin: 0.3rem 0 0;
  white-space: pre-wrap;
}

#handout-tip small {
  display: block;
  color: var(--dim);
  font-size: 0.75rem;
}

/* 뒷면의 비밀은 붉은 줄로 앞면과 구별한다 */
#handout-tip .secret-text {
  padding-left: 0.5rem;
  border-left: 3px solid #b3322b;
}

/* 숨긴 핸드아웃: GM에게만 반투명하게 보인다 */
#handout-table tr.is-hidden {
  opacity: 0.4;
}

#handout-edit .check {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  font-size: 0.85rem;
}

#handout-edit .check input {
  margin-top: 0.2rem;
}

#handout-table .has-secret {
  cursor: help;
}

#handout-table .has-secret.can-mark {
  cursor: pointer;
}

#handout-edit .back-side {
  padding: 0.3rem 0.4rem 0.4rem;
  border-left: 3px solid #b3322b;
  background: rgb(179 50 43 / 0.12);
}

#add-handout {
  margin: 0.4rem 0.5rem 0;
}

#handouts .hint,
#prizes .hint {
  margin: 0.2rem 0.5rem;
  color: var(--dim);
  font-size: 0.8rem;
}

/* GM이 핸드아웃을 고치는 창 */
#handout-edit {
  position: fixed;
  inset: auto;
  margin: 0;
  width: 18rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ink);
  color: inherit;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
}

#handout-edit:popover-open {
  display: grid;
  gap: 0.5rem;
}

#handout-edit label {
  display: grid;
  gap: 0.2rem;
}

#handout-edit :is(input, select, textarea) {
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgb(0 0 0 / 0.35);
  color: inherit;
  font: inherit;
}

#handout-edit textarea {
  resize: vertical;
}

#handout-edit .picture-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

#handout-edit #ho-image {
  width: 4rem;
  height: 4rem;
  object-fit: cover;
}

/* 감정 현황. 줄은 감정을 가진 캐릭터, 칸은 감정을 받은 캐릭터 */
#emotions > h2 {
  margin: 0 0.5rem;
  padding: 0.25rem;
  border-radius: 3px;
  background: var(--line);
  text-align: center;
  letter-spacing: 0.1em;
}

#emotion-table {
  margin: 0.3rem 0.5rem 0;
  border-collapse: collapse;
  table-layout: fixed;
  width: calc(100% - 1rem);
}

#emotion-table :is(th, td) {
  height: 2.6rem;
  padding: 0.1rem;
  border: 1px solid var(--line);
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 400;
  text-align: center;
  word-break: keep-all;
}

#emotion-table thead th {
  height: 2rem;
}

#emotion-table tbody th {
  width: 4.5rem;
  background: rgb(0 0 0 / 0.25);
}

#emotion-table .self {
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), var(--dim) 50%, transparent calc(50% + 1px)),
    linear-gradient(to bottom right, transparent calc(50% - 1px), var(--dim) 50%, transparent calc(50% + 1px));
}

#emotion-table .can-mark {
  cursor: pointer;
}

#emotion-table .can-mark:is(:hover, :focus-visible) {
  outline: 2px solid var(--paper);
  outline-offset: -2px;
}

#emotions :is(.good-emotion, .bad-emotion) {
  font-weight: 700;
}

#emotions .good-emotion,
#emotion-pick .good-emotion {
  color: #7cc4ff;
}

#emotions .bad-emotion,
#emotion-pick .bad-emotion {
  color: #ff8a80;
}

/* 감정 현황 아래의 감정표 */
#emotions h3 {
  margin: 0.4rem 0.5rem 0;
  font-size: 0.9rem;
  text-align: center;
}

#emotion-chart {
  margin: 0 0.5rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#emotion-chart th,
#emotion-chart td {
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
}

#emotion-chart th {
  width: 2rem;
  font-size: 1.1rem;
}

#emotion-chart td {
  color: var(--dim);
  text-align: center;
}

#emotion-chart span {
  font-weight: 700;
}

/* GM의 「로그 저장」에서 고르는 창 */
#log-pick {
  position: fixed;
  inset: 3rem 0.8rem auto auto;
  margin: 0;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ink);
  color: inherit;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
}

#log-pick:popover-open {
  display: grid;
  gap: 0.3rem;
}

#log-pick a {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
}

#log-pick a:hover {
  background: var(--line);
}

#emotions .hint {
  margin: 0.2rem 0.5rem;
  color: var(--dim);
  font-size: 0.8rem;
}

#emotions .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.8rem;
  margin: 0 0.5rem;
  font-size: 0.8rem;
}

/* 칸을 누르면 나오는 감정표 */
#emotion-pick {
  position: fixed;
  inset: auto;
  margin: 0;
  width: 14rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ink);
  color: inherit;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
}

#emotion-pick:popover-open {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

#emotion-pick > :is(b, button:first-of-type) {
  grid-column: 1 / -1;
}

#emotion-pick button {
  padding: 0.3rem;
  font-size: 0.85rem;
}

#emotion-pick [aria-pressed="true"] {
  background: var(--line);
  outline: 1px solid var(--paper);
}

/* 감정수정: 누가 감정을 얻으면 장면 위에 잠깐 뜬다 */
#crystal {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: radial-gradient(rgb(120 70 200 / 0.45), transparent 70%);
  color: #f1e6ff;
  font-size: clamp(2rem, 7cqw, 5rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-shadow: 0 0 0.6rem #b58cff, 0 0 1.6rem #7a3cff;
  pointer-events: none;
}

#crystal[hidden] {
  display: none;
}

/* 감정수정, 회상장면, 오의, 오의격파는 채팅에서 글자는 흰색이고 옆에 색 줄도 없다(2026-12-06 사용자 요청) */
#main .emotion,
#chat .emotion {
  font-weight: 700;
}

/* 감정수정, 오의, 오의격파 버튼을 누르면 나오는 고르기 창 */
#use-pick {
  position: fixed;
  inset: auto;
  margin: 0;
  width: 17rem;
  max-height: 70vh;
  overflow: auto;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ink);
  color: inherit;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
}

#use-pick:popover-open {
  display: grid;
  gap: 0.25rem;
}

#use-pick > b {
  padding: 0.1rem 0.2rem;
}

#use-pick p {
  margin: 0;
  color: var(--dim);
  font-size: 0.85rem;
}

#use-pick .row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
}

#use-pick button {
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  text-align: left;
}

#use-pick button small {
  display: block;
  color: var(--dim);
}

#use-pick .sure {
  outline: 2px solid #b58cff;
  color: #f1e6ff;
}

#use-pick .good-emotion {
  color: #7cc4ff;
}

#use-pick .bad-emotion {
  color: #ff8a80;
}

/* 위쪽 줄의 「오의·오의격파 연출 보기」 */
.play > header label:has(#show-ougi, #show-crystal) {
  color: var(--dim);
  font-size: 0.9rem;
  cursor: pointer;
}

#use-pick .plus-minus {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}

#use-pick .plus-minus button {
  padding: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

/* 오의와 오의격파 연출: 화면 전체에 나온다 */
#ougi-banner {
  position: fixed;
  inset: 0;
  z-index: 50;
  white-space: pre-line;
  display: grid;
  place-items: center;
  background: radial-gradient(rgb(200 40 40 / 0.45), transparent 70%);
  color: #fff0e6;
  font-size: clamp(2.5rem, 7vw, 7rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-shadow: 0 0 0.6rem #ff8a5c, 0 0 1.6rem #c81e1e;
  pointer-events: none;
}

#ougi-banner.break {
  background: radial-gradient(rgb(60 120 220 / 0.45), transparent 70%);
  text-shadow: 0 0 0.6rem #8cc8ff, 0 0 1.6rem #1e5ac8;
}

#ougi-banner[hidden] {
  display: none;
}


/* 표: 전장표, 펌블표, 변조표, 전국변조표 */
#tables > h2 {
  margin: 0 0.5rem;
  padding: 0.25rem;
  border-radius: 3px;
  background: var(--line);
  text-align: center;
  letter-spacing: 0.1em;
}

#table-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0.5rem;
}

#table-tabs button {
  flex: 1 1 auto;
  padding: 0.25rem 0.3rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

#table-tabs [aria-pressed="true"] {
  background: var(--line);
  outline: 1px solid var(--paper);
}

#table-body {
  display: grid;
  gap: 0.3rem;
  margin: 0 0.5rem;
}

#table-body .roll {
  justify-self: start;
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
}

#table-body ol {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line);
  border: 1px solid var(--line);
}

#table-body li {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0 0.4rem;
  padding: 0.35rem 0.4rem;
  background: var(--ink);
  font-size: 0.9rem;
}

#table-body li > b {
  grid-row: span 2;
  align-self: start;
  font-size: 1.3rem;
  line-height: 1;
  text-align: center;
}

#table-body li strong {
  color: #ffd27a;
}

#table-body li small {
  color: var(--dim);
  font-size: 0.8rem;
  line-height: 1.45;
}

#table-body .note {
  margin: 0;
  color: var(--dim);
  font-size: 0.8rem;
}

/* 표를 굴린 결과: 채팅과 대사 창에서 주사위 결과 뒤에 나온다 */
.dice .table-result {
  color: #ffd27a;
}

/* 캐릭터가 받은 변조. 상태 칸 아래에 붉은 글씨로 붙는다. */
#status .debuffs {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}

#status .debuffs span {
  padding: 0 0.3rem;
  border: 1px solid #ff6b6b;
  border-radius: 3px;
  background: rgb(200 30 30 / 0.25);
  color: #ffb3b3;
  font-weight: 700;
  cursor: pointer;
}

#control .debuff-pick {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line);
}

#control .debuff-pick small {
  color: var(--dim);
}

#control .debuff-pick p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  max-width: 16.5rem;
}

#control .debuff-pick button {
  padding: 0.1rem 0.35rem;
  font-size: 0.8rem;
}

#control .debuff-pick [aria-pressed="true"] {
  border-color: #ff6b6b;
  background: rgb(200 30 30 / 0.45);
  color: #fff;
}

#control .debuff-pick input {
  font-size: 0.8rem;
}

/* 생명력을 잃어 못 쓰는 분야: 회색 칸. 제목 칸에 「사용 불가」가 붙는다. */
#sheet .skills thead th.off {
  background: #6e6a70;
  color: #1c1b1d;
}

#sheet .skills tbody td.off {
  border-color: #5e5a60;
  background: #8a868c;
  color: #2e2c30;
  font-weight: 400;
}

#sheet .skills tbody td.off.have {
  background: #a08584;
  color: #3a1c1c;
  font-weight: 700;
}

/* 채팅 고치기: 내 말에 마우스를 올리면 오른쪽 위에 연필이 나온다 */
#chat li {
  position: relative;
}

#chat .edit-say {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  display: none;
  padding: 0 0.4rem;
  font-size: 0.95rem;
}

#chat li.can-edit:hover .edit-say {
  display: block;
}

#chat .edited {
  margin-left: 0.3rem;
  color: var(--dim);
  font-size: 0.75rem;
}

#edit-box {
  width: min(34rem, 90vw);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #2b2a2e;
  color: inherit;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.6);
}

#edit-box:popover-open {
  display: grid;
}

#edit-box b {
  padding: 0.8rem 1rem 0.2rem;
  font-size: 0.85rem;
  font-weight: 400;
}

#edit-box textarea {
  margin: 0 1rem 0.8rem;
  border: 0;
  border-bottom: 1px solid var(--paper);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 1.05rem;
  resize: vertical;
}

#edit-box #edit-save {
  padding: 0.8rem;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  color: #4aa8ff;
}

/* 회상장면 */
#main .recall,
#chat .recall {
  font-weight: 700;
}

/* 캐릭터 시트에서 고른 이름 색으로 말한 줄: 이름만 그 색이고 글은 흰색이다(감정수정, 회상장면, 오의도) */
#main .colored,
#chat .colored {
  color: var(--paper, #fff);
}

/* 감정 현황: 그 PC넘버의 캐릭터가 아직 없는 칸 */
#emotion-table .empty {
  background: rgb(0 0 0 / 0.2);
}

/* 채팅 칸 위 「🎨 이름 색」: 지금 말하는 캐릭터의 이름 색 고르기 */
#use-pick .swatches {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
  margin: 0.4rem 0;
}

#use-pick .swatch {
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

#use-pick .swatch[aria-pressed="true"] {
  border-color: #fff;
}

#use-pick .color-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

#use-pick input[type="color"] {
  width: 2.4rem;
  height: 1.8rem;
  padding: 0;
  border: 0;
  background: none;
}

/* 게임 화면 위쪽 줄은 버튼이 많아서(소리 목록까지) 1366px 화면에서도 한 줄에 들어가게 사이를 좁힌다 */
.play > header {
  column-gap: 0.8rem;
}

.play > header #volume {
  width: 7rem;
}

/* 프라이즈: 카드를 세로로. 못 보는 카드는 빈칸 */
#prize-list {
  display: grid;
  gap: 0.6rem;
  margin: 0.4rem 0.5rem;
}

#prize-list .prize {
  display: grid;
  gap: 0.4rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgb(0 0 0 / 0.2);
}

#prize-list .prize.blank {
  min-height: 3rem;
  border-style: dashed;
  background: none;
}

#prize-list .prize h3 {
  margin: 0;
  font-size: 1rem;
}

#prize-list .prize p {
  margin: 0;
  white-space: pre-wrap;
}

#prize-list .prize small {
  color: var(--dim);
}

#prize-list header {
  display: flex;
  gap: 0.4rem;
}

#prize-list header input {
  flex: 1;
  min-width: 0;
}

#prize-list .who {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
  align-items: center;
  font-size: 0.85rem;
}

#prize-list .who > span {
  color: var(--dim);
}

#prize-list .who label {
  display: flex;
  gap: 0.2rem;
  align-items: center;
}

#prize-list textarea {
  resize: vertical;
}

#prize-list .secret-text {
  padding-left: 0.5rem;
  border-left: 3px solid #b3322b;
}

#add-prize {
  margin: 0 0.5rem;
}

/* 전투: 장면 그림과 말 대신 참가 정하기 화면이나 전장표가 나온다 */
/* 전장표 그림은 반투명한 칸이 있어서, 뒤에 지금 장면 그림이 비친다. 장면 그림이 없으면 어두운 바탕(붉은 달은 안 보인다). */
#board.in-battle,
#board.in-battle:has(#scene:empty) {
  background: #151417;
}

#board.in-battle #characters {
  visibility: hidden;
}

#battle-join,
#battle-board {
  pointer-events: auto;
}

/* 참가 정하기: 반으로 나눠 왼쪽 미참가, 오른쪽 참가 */
#battle-join:not([hidden]) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 2px;
  background: var(--line);
}

#battle-join section {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  background: #1d1c20;
}

#battle-join section[data-joined="yes"] {
  background: #2a1f1f;
}

#battle-join h3 {
  margin: 0;
  padding: 0.4rem;
  background: rgb(0 0 0 / 0.35);
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 0.2em;
}

#battle-join .tokens {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 0.8rem;
  padding: 0.8rem;
  overflow: auto;
}

/* 전투의 말: 둥근 얼굴과 이름 */
.token {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  width: 5.5rem;
  user-select: none;
  touch-action: none;
}

.token .face {
  width: 4rem;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid #8a8490;
  border-radius: 50%;
  background: #000;
}

.token .face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.token .face span {
  display: grid;
  place-content: center;
  height: 100%;
  background: var(--red);
  font-size: 1.6rem;
  font-weight: 700;
}

.token small {
  max-width: 100%;
  overflow: hidden;
  padding: 0 0.3rem;
  border-radius: 3px;
  background: rgb(0 0 0 / 0.7);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token.can-move {
  cursor: grab;
}

.token.ghost {
  position: fixed;
  z-index: 50;
  translate: -50% -50%;
  pointer-events: none;
  opacity: 0.85;
}

/* 전장표: 0~7 그림 위 아무 데나 놓는다 */
#battle-board img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

#battle-columns,
#battle-tokens {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#battle-board .column {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12.5%;
  transition: box-shadow 0.08s;
}

/* 지금 진행 중인 플롯: 테두리가 빛난다 */
#battle-board .column.focus {
  box-shadow:
    inset 0 0 0 4px #ffcc33,
    inset 0 0 24px 6px rgb(255 204 51 / 0.55),
    0 0 18px 4px rgb(255 204 51 / 0.6);
  z-index: 0;
}

/* 그림 맨 위 글자 줄(零 壱 …)을 누르면 그 칸이 빛난다 (GM만) */
#battle-board .column-head {
  display: block;
  width: 100%;
  height: 17.4%;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
}

#battle-board .column-head:not(:disabled) {
  cursor: pointer;
}

#battle-board .column-head:not(:disabled):hover {
  background: rgb(255 204 51 / 0.18);
}

#battle-board .token {
  position: absolute;
  translate: -50% -50%;
  width: 11%;
  pointer-events: auto;
}

#battle-board .token .face {
  width: 62%;
}

#battle-board .token.held {
  z-index: 200 !important;
}

/* GM의 전투 버튼과 위쪽 줄 「전투 종료」 */
#acted .battle-control {
  padding: 0.2rem 0.7rem;
  font-size: 0.85rem;
}

#acted .battle-control:disabled {
  opacity: 0.4;
}

#battle.on {
  background: var(--red);
  color: #fff;
}

/* 참가 정하기 화면 아래: 안내와 GM의 「▶ 플롯 시작」 */
#battle-join-foot {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  justify-content: center;
  padding: 0.6rem;
  background: #1d1c20;
}

#battle-join-foot p {
  margin: 0;
  color: var(--dim);
  font-size: 0.9rem;
}

#battle-join-foot .start {
  padding: 0.45rem 1.6rem;
  border: 0;
  border-radius: 4px;
  background: var(--red);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

#battle-join-foot .start:disabled {
  opacity: 0.4;
  cursor: default;
}

/* 전장표 위의 말: 장면 위의 말처럼 캐릭터 그림 전체. 내 말은 노랗게 빛난다 */
#battle-board .token.full {
  width: calc(11% * var(--size, 1));
}

#battle-board .token.full .face {
  width: 100%;
  aspect-ratio: auto;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
}

#battle-board .token.full .face img {
  display: block;
  height: auto;
  object-fit: contain;
}

#battle-board .token.full .face span {
  aspect-ratio: 1;
  border: 2px solid var(--paper);
  border-radius: 50%;
}


/* 현재 전장: 「PC1 플롯 미완료」 왼쪽 */
#acted .field {
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
  padding: 0.2rem 0.7rem;
  border: 1px solid #5c8a6a;
  border-radius: 4px;
  background: #1f3327;
  color: #bfe8cb;
  cursor: pointer;
}

#acted .field:disabled {
  cursor: default;
  opacity: 1;
}

#acted .field span {
  font-size: 0.8rem;
  opacity: 0.8;
}
