@font-face {
  font-family: "ODK Heading";
  src: url("/study/assets/fonts/study-heading.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

:root {
  --paper: var(--study-paper);
  --cream: var(--study-cream);
  --card: var(--study-card);
  --ink: var(--study-ink);
  --muted: var(--study-muted);
  --green: var(--study-green);
  --gd: var(--study-green-dark);
  --gp: var(--study-green-pale);
  --gold: var(--study-gold);
  --line: var(--study-line);
  scrollbar-width: thin;
  scrollbar-color: #c8bea9 var(--paper);
}

body { font-family: var(--study-font); }
h1, h2 { font-family: "ODK Heading", var(--study-font); font-weight: 900; }
main { padding-inline: clamp(10px, 2vw, 24px); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, .fc:focus-visible {
  outline: 2px solid var(--ochre);
  outline-offset: 3px;
}
.panel { border-radius: var(--study-radius); min-width: 0; }
.btn { min-height: 44px; }
.btn:hover { background: var(--gp); }
.btn.p:hover { background: var(--gd); }
.in-study-app { overflow: hidden; }
.in-study-app body { min-height: 0; display: flow-root; }
.in-study-app header { position: relative; border: 0; background: transparent; }
.in-study-app .hd { height: auto; min-height: 44px; padding-inline: clamp(10px, 2vw, 24px); }
.in-study-app #nickBtn { text-decoration: none; }
.in-study-app #nickBtn:hover { text-decoration: underline; }
.in-study-app main { padding-inline: 2px; }
.in-study-app footer { display: none; }
.dlg { max-height: calc(100dvh - 32px); overflow-y: auto; }
.in-study-app .ov {
  position: absolute;
  inset: var(--room-view-top, 0px) 0 auto;
  height: var(--room-view-height, 100vh);
}
.in-study-app .dlg { max-height: calc(var(--room-view-height, 100vh) - 32px); }
.in-study-app .fan3-dialog {
  position: absolute;
  inset: calc(var(--room-view-top, 0px) + var(--room-view-height, 100vh) / 2) 0 auto;
  margin: 0 auto;
  max-height: calc(var(--room-view-height, 100vh) - 24px);
  transform: translateY(-50%);
}
.in-study-app .toast {
  position: absolute;
  top: calc(var(--room-view-top, 0px) + var(--room-view-height, 100vh) - 16px);
  bottom: auto;
  transform: translate(-50%, -100%);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(74px, .38fr);
  gap: clamp(8px, 3vw, 28px);
  align-items: center;
  margin-top: 12px;
  padding: clamp(15px, 3.5vw, 34px);
  background: linear-gradient(110deg, var(--cream), #ecf0e3);
}
.intro h1 { font-size: clamp(1.48rem, 4.5vw, 2.65rem); }
.intro .art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: auto;
  margin: 0;
  isolation: isolate;
}
.intro .art::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 12% 2% 3%;
  border-radius: 50%;
  background: var(--gp);
}
.intro .art img { position: static; width: min(100%, 196px); height: auto; }
.rt { padding: clamp(12px, 2vw, 18px); }
.rt .im {
  height: clamp(102px, 16vw, 148px);
  margin-block: 10px 12px;
  align-items: center;
  background: radial-gradient(ellipse at 50% 67%, #fffaf0 0%, #ecefdf 92%);
}
.rt .im img { width: 100%; height: 94%; object-fit: contain; }
.rt:nth-child(2) .im { background: radial-gradient(ellipse at 50% 65%, #fffaf0 0%, #eee7d5 92%); }
.rt:nth-child(3) .im { background: radial-gradient(ellipse at 50% 65%, #fff8ef 0%, #f1e6df 92%); }
.rt:nth-child(4) .im { background: radial-gradient(ellipse at 50% 65%, #fffaf0 0%, #e6ece2 92%); }
.rt h3 { line-height: 1.35; }
.rt .ft .btn { white-space: nowrap; }
.rt .star, .fdw .star { color: #79623c; }
.rt .star.on, .fdw .star.on { color: #8a6420; }
.fd { min-width: 0; }
.fd:hover { background: var(--cream); border-color: #b5c4ae; }
.fdw .fd { padding-right: 31px; }
.fd h4 { overflow-wrap: anywhere; }

.crumb { margin-top: 4px; }
.rhead {
  margin: 4px 0 clamp(12px, 2.5vw, 22px);
  padding: clamp(11px, 2vw, 19px);
  background: linear-gradient(115deg, #fff9ed, #f3ead8);
  border: 1px solid #e2d3b8;
  border-radius: var(--study-radius);
}
.rhead h2 { font-size: clamp(1.2rem, 3vw, 1.75rem); }
#rIcon:empty { display: none; }
#rIcon svg { display: block; }
.rstar { min-height: 36px; color: #79623c; }
.hall {
  padding: clamp(11px, 2.4vw, 20px);
  background: radial-gradient(ellipse at 14% 0%, #fff8e8 0%, #f3e8d3 78%);
  border-color: #e2d1b4;
}
.tables {
  gap: 18px 10px;
  margin-top: 12px;
  padding: 15px clamp(5px, 1vw, 10px) 9px;
  border: 1px solid #e8d8ba;
  border-radius: 16px;
  background: repeating-linear-gradient(0deg, #f7e9cf 0 23px, #eeddbd 23px 24px, #f9edd6 24px 46px, #eeddbd 46px 47px);
}
.tbl {
  padding: 9px 4px 8px;
  border: 1px solid #e1d3b7;
  background: linear-gradient(145deg, #fffaf0, #f6e9d3);
  box-shadow: 0 2px 4px #75552e12;
}
.tbl.mine { box-shadow: inset 0 0 0 1px #bb9658, 0 2px 4px #75552e16; }
.tbl .tn { color: #624527; background: #f2e1bd; box-shadow: 0 1px 2px #75552e16; }
.tbl.mine .tn { color: #fff9eb; background: #506952; }
.tbl .in { gap: 5px 2px; }
.tbl .in::before {
  content: '';
  grid-row: 2;
  grid-column: 1 / -1;
  justify-self: center;
  width: 78%;
  height: clamp(15px, 2.6vw, 27px);
  border: 1px solid #a57e55;
  border-radius: 6px;
  background: repeating-linear-gradient(0deg, #dbb78c 0 5px, #e9c99e 5px 6px, #e7c59a 6px 11px);
  box-shadow: 0 3px #b68e63, 0 5px 5px #7050322b;
  pointer-events: none;
}
.tbl .in > .seat:nth-child(-n+2) { grid-row: 1; }
.tbl .in > .seat:nth-child(n+3) { grid-row: 3; }
.seat.empty .cush, .seat.away .cush {
  width: min(41px, 90%);
  height: 23px;
  margin: 12px 0 5px;
  border: 1px solid #ba9570;
  border-radius: 8px 8px 10px 10px;
  background: linear-gradient(#edcda0, #ddba8d);
  box-shadow: 0 2px #ae845e, 0 4px 5px #73503226;
}
.seat.empty:hover .cush { background: #e7c889; }
.seat.empty .st { color: #6e5739; }
.cafe {
  padding: 11px 7px 8px;
  background: #f1ecdc;
  border: 1px solid #dfceb0;
}
.cafe .zh .room-icon { color: #815b39; }
#pTimer { background: linear-gradient(135deg, #fffdf5, #f8edd8); border-color: #e0cfad; }
#pTimer .timer { gap: clamp(10px, 2vw, 16px); }
#pTimer .ring { border-radius: 50%; background: #fffaf1; }
.side > :is(#pAsk, #pRx) { background: #fffaf1; border-color: #e4d7bd; }
.zh { align-items: center; flex-wrap: wrap; }
.room-icon {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.room-panel-label { display: flex; align-items: center; gap: 7px; color: var(--green); }

.room-study-feature {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: start;
}
.room-study-feature > .panel { padding: clamp(13px, 2.5vw, 22px); }
.room-study-feature #pLearn { grid-column: auto; }
.room-study-feature #pGoal { background: #f2f3e9; border-color: #d6dccd; }
.room-cards-heading { display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.room-cards-heading h3 { line-height: 1.3; font-size: clamp(1.1rem, 2.8vw, 1.4rem); }
.room-cards-heading img { width: clamp(42px, 9vw, 64px); height: auto; }
#pBeads { background: var(--cream); }
#pBeads .seg { background: #f0eadc; }
#pBeads .seg button, #pBeads .vseg button { min-height: 44px; }
#pBeads .vseg { gap: 5px; }
#pBeads .vseg button { padding-inline: clamp(6px, 1.5vw, 12px); }
#pBeads .fc { height: auto; margin: 12px 0; }
#pBeads .fc > .b2 { display: none; }
#pBeads .fc > .b1 { transform: translateY(4px); border-color: #c7d1bf; background: #e0e8d8; }
#pBeads .fc .ff {
  position: relative;
  inset: auto;
  min-height: 170px;
  padding: 12px 13px 14px;
  background: var(--card);
  box-shadow: none;
}
#pBeads .fc .paw {
  position: static;
  align-self: flex-start;
  max-width: calc(100% - 5em);
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--gp);
  color: var(--gd);
  text-align: left;
  overflow-wrap: anywhere;
}
#pBeads .fc .no { top: 16px; right: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
#pBeads .room-card-art {
  position: relative;
  display: block;
  overflow: hidden;
  width: min(112px, 65%);
  aspect-ratio: var(--art-ratio);
  margin-top: 10px;
  border-radius: 10px;
  pointer-events: none;
}
#pBeads .room-card-art[hidden] { display: none; }
#pBeads .room-card-art img {
  position: absolute;
  max-width: none;
  width: calc(var(--art-cols) * 100%);
  height: calc(var(--art-rows) * 100%);
  left: calc(var(--art-col) * -100%);
  top: calc(var(--art-row) * -100%);
}
#pBeads .fc .bk { margin-top: 14px; overflow-wrap: anywhere; }
#pBeads .room-card-art:not([hidden]) + .bk { margin-top: 6px; }
#pBeads .fc .tapH { position: static; margin-top: 14px; color: var(--green); }
.lnS { background: var(--card); padding-inline: clamp(10px, 2.4vw, 16px); }
.lnZh { min-height: 44px; }
.lnL { grid-template-columns: minmax(0, 44px) minmax(0, 1fr) auto; }
.lnL.nw { grid-template-columns: minmax(0, 1fr) auto; }
.lnK, .lnGl, .lnIntro, .lnP { overflow-wrap: anywhere; }

.avs button { min-width: 0; padding: 5px 3px 7px; color: var(--gd); }
.avs img { max-width: 100%; }
.avs span { display: block; font-size: .77rem; font-weight: 800; }

.hall .tbl .seat[data-pose] .av::after {
  position: absolute;
  z-index: 2;
  inset: auto 3% 10% 3%;
  height: 10%;
  border: 1px solid #ab8051;
  border-bottom: 3px solid #a8794a;
  border-radius: 50% 50% 24% 24% / 25% 25% 30% 30%;
  background: linear-gradient(#ecd1a5, #d6ab76);
  box-shadow: 0 2px 1px #62432d33;
  content: "";
  pointer-events: none;
}
.hall .tbl .seat[data-pose] .av > svg { z-index: 3; }

@keyframes room-read {
  0%, 100% { transform: rotate(0); }
  46%, 64% { transform: translateY(1px) rotate(-3deg); }
}
@keyframes room-greet {
  0%, 33%, 100% { transform: rotate(0); }
  10% { transform: rotate(4deg); }
  21% { transform: rotate(-3deg); }
}
.seat.focus[data-pose="tab"] .av img { animation-name: room-read; animation-duration: 5s; }
.seat.focus[data-pose="wave"] .av img { animation-name: room-greet; animation-duration: 6s; }

@media (max-width: 700px) {
  .room-study-feature { grid-template-columns: minmax(0, 1fr); }
  .rhead { gap: 6px 9px; }
  .rhead .r { margin-left: 0; }
  .rhead .r .btn { padding-inline: 11px; }
  .room-study-feature + .rwrap { margin-top: 14px; }
}

@media (max-width: 480px) {
  .intro p.d { font-size: .89rem; }
  .intro .live { gap: 5px 8px; margin-top: 10px; font-size: .82rem; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .rt .im { height: clamp(78px, 25vw, 104px); margin-block: 7px 9px; }
  .rt h3 { font-size: .99rem; line-height: 1.35; }
  .rt p { font-size: .8rem; margin-top: 4px; }
  .rt .ft { flex-wrap: wrap; padding-top: 8px; }
  .rt .ft .btn { padding-inline: 10px; }
  .rt .star { width: 28px; height: 28px; top: 8px; right: 6px; }
  .fdw .fd { padding-right: 24px; }
  .hall .tables { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seat.empty .cush, .seat.away .cush { width: min(38px, 90%); }
  .seat .av { width: min(92px, 100%); }
  .seat .av img { left: 0; width: 100%; }
  .seat .nm { max-width: 100%; }
}
