:root {
  --paper: #f7f5eb;
  --paper-light: #fffdf4;
  --ink: #233f34;
  --muted: #607065;
  --red: #a9382a;
  --red-hover: #8b2c22;
  --line: #d7d6c6;
  --serif: "Songti TC", "Noto Serif TC", "Source Han Serif TC", "PMingLiU", "MingLiU", serif;
  --sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --latin: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
  font-family: var(--sans);
  color: var(--ink);
  font-synthesis: weight;
  background-color: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; background: radial-gradient(ellipse at 83% 65%,#eee9d557,transparent 58%), var(--paper); min-height: 100vh; }
body:before { content: ""; position: fixed; inset: 0; opacity: .12; pointer-events: none; z-index: 8; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.83' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23887c51' opacity='.26' filter='url(%23n)' d='M0 0h140v140H0z'/%3E%3C/svg%3E"); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .67; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #c98432; outline-offset: 3px; }
button, a, input, textarea { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button, .primary, .outline { transition: background-color .16s, transform .16s, border-color .16s; }
h1, h2, h3, p { margin: 0; }
.definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; display: inline-block; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.masthead { border-top: 4px solid #254a3c; border-bottom: 1px solid var(--line); background: #faf8ef; }
.header-inner, .page { width: min(1160px, calc(100% - clamp(40px, 8.5vw, 154px))); margin: 0 auto; }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-stamp { color: var(--red); width: 36px; height: 43px; transform: rotate(-5deg); }
.brand strong, .brand small { display: block; }
.brand strong { font: 750 22px/1.35 var(--serif); letter-spacing: .09em; }
.brand small { color: #697b69; font: 700 8px/1.5 var(--latin); letter-spacing: .17em; margin-top: 1px; }
nav { display: flex; align-items: center; gap: 9px; }
nav a { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 650; color: #57665b; padding: 9px 12px; border: 1px solid transparent; border-radius: 5px; white-space: nowrap; }
nav a:hover { color: var(--ink); background: #ebece0; }
nav a[aria-current="page"] { color: #295342; background: #e8ecdf; border-color: #dce1d1; }
nav .icon { width: 17px; height: 17px; }
.home-intro, .teacher-intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: clamp(27px, 3.7vw, 53px) 0 clamp(20px, 2.4vw, 35px); }
h1 { font: 800 clamp(39px,4.3vw,62px)/1.22 var(--serif); letter-spacing: .045em; display: flex; align-items: center; color: #203e32; }
.heading-sparkle { width: .67em; height:.67em; margin-left: .18em; align-self: flex-start; margin-top: .04em; }
.home-intro p, .teacher-intro p { margin-top: 9px; font-size: clamp(14px,1.3vw,17px); line-height: 1.65; letter-spacing: .045em; color: #536256; }
.primary { border: 1px solid #913127; background: var(--red); color: #fff9e9; font-weight: 700; letter-spacing: .055em; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 49px; padding: 12px 20px; border-radius: 6px; box-shadow: 0 2px 0 #80372f25; }
.primary:hover:not(:disabled) { background: var(--red-hover); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.write-button { font-size: 16px; min-height: 53px; padding-inline: 21px; gap: 11px; }
.write-button .end-icon { width: 17px; margin-left: 9px; }
.tree-frame { overflow: hidden; border: 1px solid #c6cbb8; border-radius: 8px; background: #faf7e8; box-shadow: 0 3px 0 #41503b0c, 0 8px 19px #4a53350a; }
.airmail-line { height: 6px; background: repeating-linear-gradient(124deg,#a54638 0 15px,#eeebd8 15px 24px,#547768 24px 39px,#eeebd8 39px 48px); }
.scene { position: relative; isolation: isolate; overflow: hidden; height: clamp(370px, min(44vw, 57vh), 554px); min-height: 0; background: #123e36; }
.tree-stage { position: absolute; inset: 0; overflow: hidden; }
.live-pill { position: absolute; inset: 18px auto auto 19px; z-index: 2; display: inline-flex; align-items: center; gap: 7px; color: #f1f2d9; font-size: 12px; font-weight: 650; letter-spacing: .06em; padding: 6px 10px; border-radius: 24px; background: #112e28b8; border: 1px solid #bce0bc4d; pointer-events: none; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: #dfb462; }
.live-pill[data-state="online"] i { background: #a7cd92; box-shadow: 0 0 7px #bceb9280; }
.live-pill[data-state="offline"] i { background: #eea48a; }
.count-ticket { position: absolute; right: 21px; top: 19px; z-index: 2; text-align: left; color: #31453a; background: #f4eed9; padding: 11px 17px 9px; border: 1px solid #c8bfa3; border-radius: 3px; box-shadow: 2px 3px 0 #0d25253b; min-width: 100px; pointer-events: none; transform: rotate(1deg); }
.count-ticket:before { content: ""; position: absolute; inset: 4px; border: 1px dashed #afa88a; opacity: .72; border-radius: 1px; }
.ticket-label { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 11px; letter-spacing: .075em; font-weight: 650; }
.ticket-label .icon { width: 14px; height: 14px; }
.count-line { display: flex; gap: 6px; align-items: baseline; justify-content: center; margin-top: 2px; }
.count-line b { font: bold 32px/.98 Georgia,"Times New Roman",serif; color: #8b382c; font-variant-numeric: tabular-nums; }
.count-line small { font-size: 12px; font-weight: 650; }
.tree-tools { position: absolute; z-index: 2; right: 18px; bottom: 16px; display: flex; padding: 3px; background: #fbf6e7ed; border: 1px solid #ddd5bc; border-radius: 5px; color: var(--ink); box-shadow: 0 2px 8px #17382b24; }
.tree-tools button, .projection-actions button, .projection-actions a, .close-button { appearance: none; display: grid; place-content: center; background: transparent; border: 0; color: inherit; border-radius: 3px; }
.tree-tools button { width: 32px; height: 31px; }
.tree-tools button:hover, .close-button:hover { background: #dce2cf; }
.tree-tools .icon { width: 16px; height: 16px; }
.tree-tools button:last-child { border-left: 1px solid #c6c8b3; border-radius: 0; margin-left: 3px; padding-left: 7px; width: 38px; }
.scene-caption { min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 18px; color: #546354; font-size: 12px; letter-spacing: .055em; font-weight: 550; }
.scene-caption > span, .home-privacy, .form-privacy { display: inline-flex; align-items: center; }
.scene-caption .icon { width: 15px; height: 15px; margin-right: 8px; }
.caption-dot { margin: 0 7px; }
.caption-school { gap: 7px; }
.mini-star { color: #a05737; font-size: 16px; }
.home-privacy { display: flex; width: max-content; max-width: 100%; margin: 21px auto 32px; gap: 7px; color: #677468; font-size: 13px; letter-spacing: .04em; }
.home-privacy .icon, .form-privacy .icon { width: 15px; height: 15px; }
dialog, .stationery { color: var(--ink); border: 1px solid #c7cab8; background-color: var(--paper-light); border-radius: 8px; box-shadow: 0 12px 52px #0c271e22; }
dialog { width: min(460px, calc(100% - 28px)); max-height: calc(100dvh - 30px); margin: auto; padding: 0; }
dialog::backdrop { background: #122c23a1; backdrop-filter: blur(3px); }
dialog[open] { animation: arrive .18s ease-out; }
@keyframes arrive { from { opacity: 0; transform: translateY(9px); } }
body:has(dialog[open]) { overflow: hidden; }
.composer-inner { position: relative; padding: 28px 30px 30px; }
h2 { font: 750 29px/1.4 var(--serif); letter-spacing: .05em; }
.close-button { position: absolute; right: 16px; top: 16px; width: 36px; height: 36px; color: #617060; }
.close-button .icon { width: 18px; height: 18px; }
.form-privacy { margin-top: 7px; font-size: 13px; gap: 6px; color: #596d5e; }
#card-form { margin-top: 24px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
label, legend { color: #284436; font-size: 14px; font-weight: 700; }
#card-fields > label, #login-form label { display: block; margin-bottom: 7px; }
label small { font-size: 12px; font-weight: 500; color: #687568; }
.color-field { margin-bottom: 19px; }
.color-field legend { display: flex; align-items: center; }
#color-name { font-size: 12px; font-weight: 500; margin-left: 10px; color: #657365; }
.color-options { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.color-choice { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; cursor: pointer; position: relative; }
.color-choice input { opacity: 0; position: absolute; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; }
.color-chip { pointer-events: none; width: 31px; height: 31px; border-radius: 50%; background-color: var(--envelope-color); border: 1px solid #352b212b; display: grid; place-content: center; }
.color-chip .icon { width: 16px; height: 16px; stroke-width: 3; color: var(--chip-ink,#fff); opacity: 0; }
.color-choice input:checked + .color-chip { outline: 2px solid #355343; outline-offset: 2px; }
.color-choice input:checked + .color-chip .icon { opacity: 1; }
.color-choice input:focus-visible + .color-chip { outline: 3px solid #a4742e; outline-offset: 2px; }
input[type="password"],input[type="text"], textarea { width: 100%; border: 1px solid #bdc5b5; border-radius: 5px; background: #fffef9; color: var(--ink); padding: 10px 12px; font-size: 16px; line-height: 1.6; }
input::placeholder,textarea::placeholder { color: #818a7d; }
textarea { display: block; min-height: 100px; resize: vertical; }
.char-counter { margin: 3px 0 12px; text-align: right; color: #687568; font: 12px/1.3 var(--latin); }
.send-button { width: 100%; margin-top: 22px; }
.send-button .end-icon { margin-left: auto; width: 17px; }
.send-button > .icon:first-child { margin-right: auto; }
.error-text { font-size: 13px; line-height: 1.6; color: #9a382d; margin-top: 11px; }
.toast { z-index: 20; position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 30px); border-radius: 7px; padding: 12px 20px; box-shadow: 0 4px 24px #182b2733; text-align: center; background: #223f32; color: #fcf6e4; font-size: 14px; }
.projector-page { position: fixed; inset: 0; overflow: hidden; isolation: isolate; background: #163e34; color: #fff6dd; }
.projector-title,.projection-actions,.qr-ticket,.projector-count { position: absolute; z-index: 2; }
.projector-title { left: 3vw; top: 3.5vh; display: flex; align-items: center; gap: 12px; font: 700 clamp(20px,2vw,36px)/1.3 var(--serif); letter-spacing: .08em; text-shadow: 0 1px 6px #0b3426; pointer-events: none; }
.projector-title > svg { width: 1.4em; height: 1.6em; color: #bc5140; }
.projection-actions { right: 2.5vw; top: 3.5vh; display:flex; gap: 6px; }
.projection-actions button,.projection-actions a { width: 37px; height: 37px; color: #f8f3df; background: #13372ecc; border: 1px solid #e8e9cb66; }
.projection-actions button:hover,.projection-actions a:hover { background: #264f41; }
.qr-ticket { display: flex; align-items: center; flex-direction: column; gap: 4px; left: 2.7vw; bottom: 3.4vh; background: #fffaf0; border-radius: 4px; padding: 7px 8px 10px; color: var(--ink); box-shadow: 0 3px 8px #17382b33; font-size: clamp(12px,1vw,20px); font-weight: 700; }
.qr-ticket img { display: block; width: clamp(82px,10vw,200px); height: auto; aspect-ratio: 1; }
.projector-count { bottom: 3.4vh; right: 2.7vw; background: #fbf4df; color: #244232; border-radius: 4px; padding: 10px clamp(12px,1.3vw,30px); text-align: center; pointer-events: none; }
.projector-count>span { display: block; font-weight: 700; letter-spacing: .09em; font-size: clamp(12px,1.1vw,22px); }
.projector-count b { font: 700 clamp(31px,4.5vw,90px)/1.1 Georgia,serif; color: var(--red); }
.projector-count small { margin-left: 5px; font-size: clamp(12px,1.3vw,24px); }
.projector-count #projector-state { margin-top: 3px; font-size: 11px; font-weight: 500; }
.teacher-page { max-width: 950px; padding-bottom: 48px; }
.teacher-intro h1 { font-size: clamp(36px,3.7vw,53px); }
.outline { background: #faf8ee; border: 1px solid #bcc5b5; color: var(--ink); padding: 9px 16px; border-radius: 5px; font-size: 14px; font-weight: 650; }
.outline:hover { background: #e7eadd; }
.loading-status { padding: 25px 0; color: var(--muted); }
.stationery { overflow: hidden; width: min(445px,100%); margin: 14px auto 0; }
.login-inner { padding: 25px 30px 32px; }
.login-stamp { width: 36px; height: 44px; color: var(--red); margin-bottom: 12px; transform: rotate(-6deg); }
.login-inner > p,.inbox-empty p { color: var(--muted); font-size: 14px; line-height: 1.6; margin-top: 5px; }
#login-form { margin-top: 23px; }
#login-form button { margin-top: 16px; width: 100%; }
.inbox { background: #fbf9ef; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.inbox-header { padding: 18px 23px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.inbox-header h2 { font-size: 22px; }
#admin-count { margin-left: 4px; font: 700 13px var(--latin); background: #e7eadb; border-radius: 14px; padding: 3px 9px; vertical-align: middle; }
.admin-live { font-size: 12px; color: #54725c; }
.admin-card { padding: 17px 24px; border-bottom: 1px solid #dee0d1; }
.admin-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 680; }
.admin-meta .icon { width: 18px; height: 18px; }
.admin-meta time { color: #697569; font-weight: 450; margin-left: auto; font: 12px var(--latin); }
.admin-card p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; margin-top: 8px; color: #364d3e; }
.admin-meta strong { overflow-wrap: anywhere; }
.inbox-empty { padding: 56px 20px; text-align: center; }
.inbox-empty .icon { color: var(--red); width: 32px; height: 32px; margin-bottom: 9px; }
.inbox-empty h3 { font-size: 19px; font-family: var(--serif); }
.load-more { display: block; margin: 17px auto; }
@media (min-width: 1500px) { .header-inner,.page { width: min(1280px,90%); } .teacher-page { max-width: 1000px; } }
@media (max-width: 740px) {
  .header-inner,.page { width: calc(100% - 36px); }
  .header-inner { min-height: 65px; }
  .brand { gap: 8px; }
  .brand-stamp { width: 29px; height: 35px; }
  .brand strong { font-size: 19px; }
  .brand small { font-size: 6.5px; }
  nav { gap: 2px; }
  nav a { font-size: 12px; padding: 8px; gap: 5px; }
  .scene { height: clamp(360px,56dvh,510px); }
  .home-intro { padding-block: 26px 22px; }
  .home-intro p { letter-spacing: .015em; }
  .write-button { padding-inline: 13px; font-size: 14px; min-height: 47px; }
  .write-button .end-icon { display: none; }
}
@media (max-width: 560px) {
  .header-inner,.page { width: calc(100% - 28px); }
  .header-inner { gap: 4px; min-height: 59px; }
  nav { gap: 2px; }
  nav a { padding: 7px 5px; font-size: 11px; gap: 3px; }
  nav .icon { width: 14px; height: 14px; }
  #nav-tree { display:none; }
  .brand strong { font-size: 18px; }
  .brand small { font-size: 6px; }
  .home-intro { align-items: flex-start; flex-direction: column; gap: 15px; padding: 23px 1px 17px; }
  h1 { font-size: 38px; }
  .home-intro p { font-size: 14px; margin-top: 5px; }
  .write-button { gap: 8px; min-height: 41px; padding: 8px 14px; font-size: 14px; }
  .write-button .icon { width: 16px; height: 16px; }
  .write-button .end-icon { display: inline; width: 14px; margin-left: 7px; }
  .scene { height: clamp(345px, 55dvh, 490px); }
  .live-pill { top: 10px; left: 10px; font-size: 10px; padding: 5px 7px; gap: 4px; }
  .live-pill i { width: 5px; height: 5px; }
  .count-ticket { top: 10px; right: 10px; min-width: 63px; padding: 6px 8px; }
  .count-ticket:before { inset: 2px; }
  .ticket-label { font-size: 9px; gap: 3px; }
  .ticket-label .icon { width: 11px; height: 11px; }
  .count-line b { font-size: 22px; }
  .count-line small { font-size: 10px; }
  .tree-tools { right: 8px; bottom: 8px; padding: 1px; }
  .tree-tools button { width: 32px; height: 32px; }
  .tree-tools button:last-child { width: 35px; }
  .scene-caption { min-height: 37px; padding: 7px 10px; font-size: 10px; letter-spacing: .01em; }
  .scene-caption .icon { width: 12px; height: 12px; margin-right: 5px; }
  .caption-dot { margin: 0 4px; }
  .caption-school { gap: 4px; }
  .home-privacy { margin-top: 16px; font-size: 12px; }
  .composer-inner { padding: 24px 20px 22px; }
  .close-button { top: 10px; right: 10px; }
  .form-privacy { font-size: 12px; }
  .teacher-intro { padding: 25px 0; }
  .admin-card,.inbox-header { padding: 14px; }
  .qr-ticket img { width: 78px; }
  .projector-title { font-size: 17px; gap: 6px; }
}
@media (max-width: 350px) { .brand-stamp { width: 24px; } .brand { gap: 5px; } .brand strong { font-size: 16px; } .header-inner,.page { width: calc(100% - 20px); } .caption-school { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; } }
.school-emblem { display: block; width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; }
.projector-title .school-emblem { width: 1.8em; height: 1.8em; padding: 2px; background: #fbf8ea; border-radius: 50%; }
@media (max-width: 740px) { .school-emblem { width: 35px; height: 35px; } }
@media (max-width: 350px) { .school-emblem { width: 29px; height: 29px; } }
