@import url("https://fonts.googleapis.com/css2?family=Gowun+Batang:wght@400;700&family=Gowun+Dodum&family=Jua&display=swap");

:root {
  --cream: #fff8ec;
  --paper: #ffffff;
  --ink: #2c2c2a;
  --soft: #854f0b;
  --line: #f1dcb4;
  --coral: #d85a30;
  --coral-dark: #993c1d;
  --green: #1d9e75;
  --green-dark: #0f6e56;
  --yellow: #faeeda;
  --yellow-line: #fac775;
  --purple-bg: #eeedfe;
  --purple: #3c3489;
  --gold: #c9a24b;
  --gold-light: #e6c77a;
  --wall: #fbf3e1;
  --shelf-back: #f3e6c8;
  --wood: #c99a5b;
  --ui: "Gowun Dodum", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --head: "Jua", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --book: "Gowun Batang", "AppleMyungjo", "Batang", serif;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.55;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3 {
  font-family: var(--head);
  font-weight: 400;
  margin: 0;
  line-height: 1.25;
}
h1 {
  font-size: 30px;
}
h2 {
  font-size: 24px;
}
h3 {
  font-size: 19px;
}
p {
  margin: 0;
}
small {
  color: var(--soft);
  font-size: 13px;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}
.wrap.wide {
  max-width: 1180px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.logo {
  font-family: var(--head);
  font-size: 20px;
  color: var(--coral);
  text-decoration: none;
}
.who-me {
  font-size: 15px;
  color: var(--soft);
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.between {
  justify-content: space-between;
}
.center {
  text-align: center;
}
.muted {
  color: var(--soft);
}

.btn {
  font-family: var(--head);
  font-size: 19px;
  background: var(--coral);
  color: #fff;
  border: 0;
  border-radius: 14px;
  padding: 12px 20px;
  min-height: 50px;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
}
.btn.green {
  background: var(--green);
}
.btn.ghost {
  background: var(--paper);
  color: var(--coral-dark);
  border: 1.5px solid #f0997b;
}
.btn.small {
  font-size: 15px;
  padding: 6px 12px;
  min-height: 36px;
  border-radius: 10px;
}
.btn.block {
  width: 100%;
}
.link {
  background: none;
  border: 0;
  padding: 4px 6px;
  color: var(--soft);
  text-decoration: underline;
  font-size: 14px;
}
.link.danger {
  color: #a32d2d;
}
.finish-link {
  display: block;
  margin: 18px 0 0 auto;
  color: #888780;
  font-size: 13px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > span {
  font-size: 15px;
  color: var(--soft);
}
.input,
textarea.input,
select.input {
  width: 100%;
  background: var(--paper);
  border: 2px solid var(--yellow-line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 18px;
  outline: none;
}
.input:focus {
  border-color: var(--green);
}
textarea.input {
  resize: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 1px solid var(--yellow-line);
  color: #633806;
  border-radius: 30px;
  padding: 4px 12px;
  margin: 3px 3px 0 0;
  font-size: 15px;
}
.chip.me {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}
.chip.off {
  opacity: 0.5;
}
.chip button {
  border: 0;
  background: none;
  padding: 0 2px;
  color: inherit;
  font-size: 14px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b4b2a9;
}
.dot.on {
  background: var(--green);
}
.badge {
  background: var(--purple-bg);
  color: var(--purple);
  border-radius: 30px;
  padding: 3px 12px;
  font-size: 14px;
  white-space: nowrap;
}
.badge.done {
  background: #e1f5ee;
  color: #085041;
}

.banner {
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  font-family: var(--head);
  font-size: 21px;
}
.banner.go {
  background: var(--green);
  color: #fff;
}
.banner.wait {
  background: var(--yellow);
  color: #633806;
  border: 1px solid var(--yellow-line);
}
.banner .clock {
  font-size: 15px;
  margin-left: 8px;
}
.banner small {
  color: inherit;
}

.bar {
  height: 10px;
  background: var(--yellow);
  border-radius: 10px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 10px;
  transition: width 0.3s;
}
.bar-txt {
  font-size: 13px;
  color: var(--soft);
  text-align: right;
  margin-top: 2px;
}

.lines {
  max-height: 46vh;
  overflow-y: auto;
}
.lines p {
  padding: 5px 0;
  font-size: 18px;
}
.lines p + p {
  border-top: 1px dashed var(--line);
}
.who {
  color: var(--coral-dark);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
  margin-left: 4px;
}
.big-group {
  font-family: var(--head);
  font-size: 40px;
  color: var(--purple);
}

#composer {
  position: sticky;
  bottom: 0;
  background: var(--cream);
  padding: 10px 0 12px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#composer .input {
  border-color: var(--green);
}
.count {
  font-size: 13px;
  color: var(--soft);
}

/* 알림과 확인 창 */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 15px;
  transition: 0.25s;
  pointer-events: none;
  z-index: 90;
  max-width: 90vw;
  text-align: center;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 30, 10, 0.5);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.dialog {
  background: var(--paper);
  border-radius: 20px;
  padding: 22px;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dialog.big {
  width: min(560px, 100%);
}
.dialog-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}
.offline {
  background: #fcebeb;
  color: #791f1f;
  text-align: center;
  padding: 6px;
  font-size: 14px;
}

/* 선생님 화면 */
.t-grid {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) {
  .t-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.qr {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  line-height: 0;
}
.qr svg {
  width: 100%;
  height: auto;
}
.code {
  font-family: var(--head);
  font-size: 30px;
  letter-spacing: 4px;
  color: var(--coral);
}
.join-url {
  font-size: 13px;
  word-break: break-all;
  color: var(--soft);
}
.qr-big {
  background: #fff;
  border-radius: 24px;
  padding: 28px;
  text-align: center;
  width: min(92vw, 78vh);
}
.qr-big .qr {
  border: 0;
}
.g-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.gcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.g-now {
  font-size: 16px;
}
.g-lines {
  margin: 0;
  padding-left: 22px;
  max-height: 190px;
  overflow-y: auto;
  font-size: 15px;
}
.g-lines li {
  padding: 2px 0;
}
.g-lines .x {
  border: 0;
  background: none;
  color: #a32d2d;
  font-size: 13px;
  padding: 0 4px;
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--head);
  font-size: 20px;
}
.stepper button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #f0997b;
  background: var(--paper);
  color: var(--coral-dark);
  font-size: 20px;
}
.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.range-row input {
  flex: 1;
  accent-color: var(--coral);
}
.range-row b {
  font-family: var(--head);
  font-weight: 400;
  font-size: 20px;
  min-width: 64px;
  text-align: right;
}

/* ---------- 서재 ---------- */
.library {
  background: var(--wall);
  border: 1px solid #e3cfa4;
  border-radius: 20px;
  padding: 18px 16px 10px;
  font-family: var(--book);
}
.library > h2 {
  font-family: var(--book);
  font-weight: 700;
  color: #5a3a12;
  font-size: 22px;
}
.library > h2 span {
  color: var(--gold);
}
.shelf-tag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #7a5a1e;
  margin: 14px 4px 6px;
}
.shelf {
  background: var(--shelf-back);
  border-radius: 10px 10px 0 0;
  padding-top: 22px;
  overflow-x: auto;
}
.shelf-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0 12px;
  min-height: 276px;
  width: max-content;
  min-width: 100%;
}
.plank {
  height: 14px;
  background: var(--wood);
  border-top: 2px solid #e0b87c;
  border-bottom: 2px solid #a67a40;
  border-radius: 2px;
}

.c0 {
  --leather: #7a2730;
  --leather-dark: #561820;
}
.c1 {
  --leather: #2c5a3d;
  --leather-dark: #1c3d28;
}
.c2 {
  --leather: #2a3f6b;
  --leather-dark: #1a2a4b;
}
.c3 {
  --leather: #5c3157;
  --leather-dark: #3f1f3b;
}
.c4 {
  --leather: #6e4320;
  --leather-dark: #4a2c12;
}
.c5 {
  --leather: #266064;
  --leather-dark: #164043;
}

.spine {
  width: 46px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 6px 6px 1px 1px;
  background-color: var(--leather);
  color: var(--gold-light);
  font-family: var(--book);
  background-image: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.32),
    rgba(255, 255, 255, 0.12) 30%,
    rgba(0, 0, 0, 0.04) 62%,
    rgba(0, 0, 0, 0.34)
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s;
}
.spine:hover {
  transform: translateY(-6px);
}
.spine.out {
  transform: translateY(-18px);
}
.spine .band {
  width: 100%;
  height: 5px;
  flex: none;
  background: var(--gold);
  border-top: 1px solid #f0d48a;
  border-bottom: 1px solid #7a5a1e;
}
.spine .seg {
  height: 26px;
  flex: none;
  display: flex;
  align-items: center;
  font-size: 15px;
}
.sp-title {
  writing-mode: vertical-rl;
  flex: 1;
  min-height: 0;
  width: 30px;
  margin: 5px 0;
  overflow: hidden;
  display: block;
  text-align: center;
  line-height: 28px;
  white-space: nowrap;
  border: 1px solid var(--gold);
  background: rgba(0, 0, 0, 0.22);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
}
.sp-grp {
  height: 24px;
  flex: none;
  display: flex;
  align-items: center;
  font-size: 11px;
  white-space: nowrap;
}

.cover,
.big-cover {
  flex: none;
  background-color: var(--leather);
  color: var(--gold-light);
  font-family: var(--book);
  border-left: 10px solid var(--leather-dark);
  border-radius: 3px 9px 9px 3px;
  padding: 7px;
  background-image:
    radial-gradient(
      ellipse at 30% 18%,
      rgba(255, 255, 255, 0.16),
      transparent 62%
    ),
    radial-gradient(ellipse at 80% 90%, rgba(0, 0, 0, 0.28), transparent 60%);
}
.cover {
  width: 180px;
  height: 250px;
  margin-left: 18px;
}
.cover-in {
  height: 100%;
  border: 1px solid var(--gold);
  outline: 1px solid var(--gold);
  outline-offset: -5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 8px 12px;
  text-align: center;
}
.orn {
  font-size: 18px;
}
.medal {
  width: 88%;
  aspect-ratio: 1.7;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 9%;
}
.fit {
  display: block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  font-weight: 700;
  font-size: 17px;
  text-align: center;
}
.fit.wrap {
  white-space: normal;
  word-break: keep-all;
  line-height: 1.25;
}
.by {
  font-size: 13px;
  line-height: 1.5;
}
.by small {
  color: inherit;
  opacity: 0.85;
}
.open-btn {
  background: var(--gold-light);
  color: var(--leather-dark);
  border: 0;
  border-radius: 30px;
  padding: 5px 14px;
  font-family: var(--ui);
  font-size: 14px;
}

.book-detail {
  margin-top: 10px;
  font-family: var(--ui);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bd-title small {
  margin-left: 6px;
}
.rate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 36px;
}
.rate-row b {
  min-width: 92px;
  font-weight: 400;
  color: var(--soft);
  font-size: 15px;
}
.stars {
  color: #ef9f27;
  font-size: 22px;
  letter-spacing: 1px;
}
.stars .off {
  color: #d3d1c7;
}
.stars.pick button {
  background: none;
  border: 0;
  padding: 0 3px;
  font-size: 30px;
  line-height: 1;
  color: #d3d1c7;
}
.stars.pick button.on {
  color: #ef9f27;
}

/* ---------- 낭독 책 ---------- */
.reader {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: #f6ead0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  font-family: var(--book);
}
.rd-close {
  align-self: flex-end;
  margin: 12px 14px 0;
  background: #fff;
  border: 1px solid #e3cfa4;
  border-radius: 30px;
  padding: 6px 14px;
  font-family: var(--ui);
  font-size: 15px;
  color: #5a3a12;
}
.rd-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px 16px 24px;
}
.big-cover {
  width: min(340px, 78vw);
  aspect-ratio: 0.74;
  border-left-width: 18px;
  padding: 12px;
}
.big-cover .orn {
  font-size: 30px;
}
.big-cover .fit {
  font-size: 30px;
}
.big-cover .by {
  font-size: 17px;
}
.book {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--leather);
  border-radius: 12px;
  padding: 10px 10px 13px;
  box-shadow: 0 10px 24px rgba(74, 44, 18, 0.25);
}
.book.per1 {
  grid-template-columns: minmax(0, 1fr);
  width: min(560px, 100%);
}
.page {
  background: #fbf1d9;
  color: #3a2a14;
  min-height: min(56vh, 520px);
  padding: clamp(18px, 3.4vw, 44px) clamp(18px, 3.2vw, 42px) 14px;
  display: flex;
  flex-direction: column;
}
.page.left {
  border-radius: 6px 0 0 6px;
  background-image: linear-gradient(
    90deg,
    transparent 88%,
    rgba(90, 58, 18, 0.16)
  );
}
.page.right {
  border-radius: 0 6px 6px 0;
  background-image: linear-gradient(
    270deg,
    transparent 88%,
    rgba(90, 58, 18, 0.16)
  );
}
.page.single {
  border-radius: 6px;
}
.page-text {
  font-size: clamp(19px, 2.3vw, 30px);
  line-height: 2;
  word-break: keep-all;
}
.sen {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 3px;
  transition: background 0.2s;
}
.sen.on {
  background: #f4cf6e;
  color: #412402;
}
.page .who {
  font-family: var(--ui);
}
.page-no {
  margin-top: auto;
  padding-top: 12px;
  text-align: center;
  font-size: 14px;
  color: #9a7b45;
}
.page-end {
  text-align: center;
  color: #9a7b45;
  margin-top: 18px;
  font-size: 18px;
}
.page.blank {
  justify-content: center;
}
.rd-ctl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--ui);
  color: #5a3a12;
}
.rd-round {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid #c99a5b;
  background: #fff;
  color: #5a3a12;
  font-size: 22px;
  line-height: 1;
}
.rd-round.main {
  width: 60px;
  height: 60px;
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
  font-size: 20px;
}
.rd-main {
  font-family: var(--head);
  font-size: 20px;
  background: var(--coral);
  color: #fff;
  border: 0;
  border-radius: 30px;
  padding: 12px 26px;
}
.rd-pill {
  border: 1.5px solid #c99a5b;
  background: #fff;
  color: #5a3a12;
  border-radius: 30px;
  padding: 6px 14px;
  font-size: 15px;
}
.rd-no {
  min-width: 56px;
  text-align: center;
  font-size: 15px;
}
