:root {
  --ink: #30445a;
  --ink-soft: #66758a;
  --cream: #fff9eb;
  --paper: #fffef9;
  --yellow: #ffd768;
  --yellow-deep: #efb82f;
  --green: #9bd7b5;
  --green-deep: #3a9470;
  --blue: #9fd9ef;
  --blue-deep: #3b8db2;
  --pink: #f7b7c7;
  --pink-deep: #c76682;
  --orange: #ffb66e;
  --line: rgba(48, 68, 90, .12);
  --shadow: 0 18px 45px rgba(66, 79, 100, .12);
  --radius: 26px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(255, 215, 104, .23), transparent 22rem),
    radial-gradient(circle at 92% 16%, rgba(159, 217, 239, .24), transparent 24rem),
    #fffdf6;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.75;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.shell { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.section { padding: 88px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 1000; background: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); }
.skip-link:focus { top: 16px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 253, 246, .88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(48, 68, 90, .08);
}
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 16px;
  display: grid; place-items: center;
  color: #fff; font-weight: 900; font-size: 14px; letter-spacing: .08em;
  background: linear-gradient(145deg, #50ad83, #3b8db2);
  box-shadow: 0 8px 18px rgba(59, 141, 178, .18);
  transform: rotate(-3deg);
}
.brand-copy { display: grid; line-height: 1.3; }
.brand-copy strong { font-size: 15px; }
.brand-copy small { color: var(--ink-soft); margin-top: 3px; }
.main-nav { display: flex; align-items: center; gap: 8px; }
.main-nav a { padding: 9px 14px; border-radius: 999px; font-weight: 700; font-size: 15px; }
.main-nav a:hover, .main-nav a:focus-visible { background: #fff2ba; }
.nav-toggle { display: none; border: 0; background: #fff1b3; color: var(--ink); width: 44px; height: 44px; border-radius: 14px; cursor: pointer; }

.hero { position: relative; overflow: hidden; padding: 88px 0 74px; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(48,68,90,.07) 1.1px, transparent 1.1px);
  background-size: 23px 23px; mask-image: linear-gradient(to bottom, #000, transparent 88%);
}
.hero-grid { position: relative; z-index: 2; display: grid; grid-template-columns: 1.08fr .92fr; gap: 62px; align-items: center; }
.eyebrow, .section-kicker { font-weight: 900; letter-spacing: .15em; color: var(--green-deep); font-size: 13px; }
.hero h1 { margin: 10px 0 20px; max-width: 780px; font-size: clamp(42px, 6vw, 74px); line-height: 1.08; letter-spacing: -.045em; }
.hero h1::after { content: ""; display: block; width: 145px; height: 13px; margin-top: 10px; background: var(--yellow); border-radius: 100%; transform: rotate(-2deg); opacity: .75; }
.hero-lead { font-size: clamp(18px, 2vw, 21px); color: var(--ink-soft); max-width: 650px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 18px; }
.btn {
  min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: 0; border-radius: 16px; font-weight: 900; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 12px 26px rgba(48,68,90,.18); }
.btn-primary:hover { background: #21364b; }
.btn-soft { background: #fff0b3; color: #624e13; }
.btn-light { background: #fff; color: var(--ink); }
.hero-note { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-soft); background: rgba(255,255,255,.76); padding: 8px 12px; border-radius: 12px; }

.hero-board { position: relative; min-height: 460px; background: #ffeaa2; border-radius: 42px 20px 46px 24px; box-shadow: var(--shadow); transform: rotate(1deg); padding: 34px; border: 3px solid rgba(255,255,255,.75); }
.hero-board::before, .hero-board::after { content:""; position:absolute; background:#fffdf4; border-radius: 50%; opacity:.8; }
.hero-board::before { width: 95px; height: 95px; right: -28px; top: 60px; }
.hero-board::after { width: 56px; height: 56px; left: -22px; bottom: 55px; }
.board-pin { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #f17e77; box-shadow: 0 4px 0 rgba(0,0,0,.08); z-index: 4; }
.pin-a { top: 22px; left: 38%; } .pin-b { top: 30px; right: 18%; background:#64a9d0; }
.chalkboard { position: relative; z-index: 2; height: 310px; border-radius: 20px; background: #38695b; border: 12px solid #b77c4e; box-shadow: inset 0 0 0 3px rgba(255,255,255,.08), 0 12px 28px rgba(63,60,45,.18); display: grid; place-items: center; text-align: center; color: #fffdf1; overflow: hidden; }
.chalkboard p { font-size: clamp(32px, 4vw, 48px); line-height: 1.35; font-weight: 900; transform: rotate(-2deg); margin: 0; text-shadow: 1px 1px 0 rgba(255,255,255,.15); }
.chalk-doodles { position: absolute; bottom: 24px; right: 28px; font-size: 24px; opacity: .78; letter-spacing: 8px; }
.chalk-line { position: absolute; height: 3px; width: 84px; background: rgba(255,255,255,.65); border-radius: 99px; }
.line-a { left: 20px; top: 30px; transform: rotate(8deg); } .line-b { right: 25px; top: 56px; width: 58px; transform: rotate(-12deg); }
.desk-row { position: relative; z-index: 3; display: flex; justify-content: center; align-items: end; gap: 28px; font-size: 42px; margin-top: 12px; }
.hero-deco { position: absolute; z-index: 1; filter: drop-shadow(0 8px 12px rgba(48,68,90,.08)); }
.deco-pencil { left: 3%; top: 22%; font-size: 52px; transform: rotate(-18deg); }
.deco-star { right: 2.5%; top: 18%; font-size: 42px; transform: rotate(12deg); }
.deco-book { left: 7%; bottom: 7%; font-size: 44px; transform: rotate(9deg); }
.deco-heart { right: 7%; bottom: 9%; font-size: 42px; transform: rotate(-12deg); }

.stats-strip { padding: 0 0 34px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 18px 20px; background: rgba(255,255,255,.82); border: 1px solid rgba(48,68,90,.09); border-radius: 20px; box-shadow: 0 10px 30px rgba(66,79,100,.07); }
.stat-icon { grid-row: 1 / span 2; font-size: 31px; }
.stat-card strong { font-size: 25px; line-height: 1.25; }
.stat-card span:last-child { color: var(--ink-soft); font-size: 14px; }

.section-heading { max-width: 760px; margin-bottom: 38px; }
.section-heading.centered { margin-inline: auto; text-align: center; }
.section-heading h2, .write-intro h2, .kindness-card h2 { font-size: clamp(30px, 4vw, 46px); line-height: 1.2; margin: 7px 0 14px; letter-spacing: -.025em; }
.section-heading p, .write-intro > p { color: var(--ink-soft); font-size: 17px; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.step-card { position: relative; min-height: 260px; padding: 28px; border-radius: 28px; overflow: hidden; border: 2px solid rgba(255,255,255,.9); box-shadow: var(--shadow); }
.step-card h3 { font-size: 23px; margin: 12px 0 7px; }
.step-card p { color: #536275; margin: 0; }
.step-no { position: absolute; right: 20px; top: 14px; font-size: 52px; font-weight: 900; opacity: .09; }
.step-emoji { font-size: 48px; }
.step-yellow { background: #fff1b8; transform: rotate(-1deg); }
.step-green { background: #d9f3e4; transform: rotate(.8deg); }
.step-blue { background: #dff2fb; transform: rotate(-.5deg); }

.write-section { background: linear-gradient(180deg, #f6fbf8, #fffdf6); border-block: 1px solid rgba(48,68,90,.06); }
.write-grid { display: grid; grid-template-columns: .78fr 1.22fr; gap: 48px; align-items: start; }
.write-intro { position: sticky; top: 110px; }
.mini-note { margin-top: 26px; padding: 18px 20px; display: flex; gap: 13px; background: #fff0b5; border-radius: 18px 26px 17px 24px; transform: rotate(-1deg); }
.mini-note > span { font-size: 28px; }
.mini-note p { margin: 0; }
.note-form { background: #fff; border-radius: 30px; padding: 30px; box-shadow: var(--shadow); border: 1px solid rgba(48,68,90,.08); }
.form-grid { display: grid; gap: 18px; }
.two-cols { grid-template-columns: 1fr 1fr; }
.note-form label { display: grid; gap: 8px; font-weight: 800; }
.note-form label > span b { color: #d4516d; }
.note-form input[type="text"], .note-form select, .note-form textarea, .wall-toolbar input, .wall-toolbar select {
  width: 100%; border: 1.5px solid #dce3e8; background: #fffefb; color: var(--ink); border-radius: 14px; outline: none; transition: border .2s, box-shadow .2s;
}
.note-form input[type="text"], .note-form select, .wall-toolbar input, .wall-toolbar select { min-height: 48px; padding: 0 14px; }
.note-form textarea { min-height: 150px; resize: vertical; padding: 14px; line-height: 1.7; }
.note-form input:focus, .note-form select:focus, .note-form textarea:focus, .wall-toolbar input:focus, .wall-toolbar select:focus { border-color: #6fb8d1; box-shadow: 0 0 0 4px rgba(111,184,209,.14); }
.full-field { margin-top: 18px; }
.full-field small { justify-self: end; color: var(--ink-soft); font-weight: 500; }
.check-row { display: flex !important; grid-template-columns: auto 1fr; align-items: start; gap: 10px !important; margin-top: 16px; font-weight: 600 !important; color: #5f6e80; }
.check-row input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--green-deep); }
.legal-check { padding-top: 15px; border-top: 1px dashed #d9dfe4; }
.hp-field { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 22px; }
.submit-btn[disabled] { opacity: .6; cursor: wait; }
.form-status { margin: 0; min-height: 26px; color: var(--green-deep); font-weight: 800; }
.form-status.error { color: #c15363; }

.wall-section { position: relative; }
.wall-section::before { content:""; position:absolute; inset:0; background-image: linear-gradient(rgba(255,221,126,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,221,126,.12) 1px, transparent 1px); background-size: 34px 34px; pointer-events:none; }
.wall-section .shell { position: relative; z-index: 1; }
.wall-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 170px auto; align-items: center; gap: 12px; padding: 14px; background: rgba(255,255,255,.86); border-radius: 20px; border: 1px solid rgba(48,68,90,.08); margin-bottom: 28px; box-shadow: 0 10px 28px rgba(66,79,100,.07); }
.search-box { position: relative; display: flex; align-items: center; }
.search-box > span { position: absolute; left: 14px; z-index: 2; }
.search-box input { padding-left: 42px; }
.result-count { font-weight: 800; color: var(--ink-soft); white-space: nowrap; justify-self: end; }
.notes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; align-items: start; min-height: 220px; }
.note-card { --tilt: -1deg; position: relative; min-height: 260px; padding: 32px 26px 25px; border-radius: 5px 6px 12px 8px; background: #fff2ae; box-shadow: 0 16px 32px rgba(64,76,95,.12); transform: rotate(var(--tilt)); overflow: visible; }
.note-card:nth-child(4n+2) { background: #d9f0fb; --tilt: 1.1deg; }
.note-card:nth-child(4n+3) { background: #dff2df; --tilt: -.5deg; }
.note-card:nth-child(4n+4) { background: #ffdfe7; --tilt: .8deg; }
.note-card:hover { transform: rotate(0deg) translateY(-4px); transition: transform .18s ease; }
.tape { position: absolute; width: 78px; height: 24px; top: -11px; left: calc(50% - 39px); background: rgba(255,255,255,.57); border: 1px solid rgba(255,255,255,.64); transform: rotate(-2deg); box-shadow: inset 0 0 8px rgba(117,108,76,.08); }
.note-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 12px; color: #6f7c8a; }
.role-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 10px; background: rgba(255,255,255,.58); border-radius: 999px; font-weight: 900; }
.note-recipient { font-size: 21px; margin: 17px 0 11px; }
.note-recipient::before { content: "給 "; font-size: 13px; color: #74808d; font-weight: 700; }
.note-message { font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 24px; }
.note-signature { font-size: 13px; color: #667482; font-weight: 800; border-top: 1px dashed rgba(48,68,90,.18); padding-top: 10px; }
.note-doodle { position: absolute; right: 18px; bottom: 11px; font-size: 28px; color: rgba(194,85,112,.62); transform: rotate(10deg); }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 55px 18px; border: 2px dashed #d9e0e5; border-radius: 24px; background: rgba(255,255,255,.68); color: var(--ink-soft); }
.empty-state strong { display: block; font-size: 24px; color: var(--ink); margin-bottom: 6px; }
.pagination { margin-top: 34px; display: flex; justify-content: center; gap: 14px; align-items: center; }
.pagination button { border: 1px solid #d6dde3; background: #fff; padding: 10px 15px; border-radius: 12px; cursor: pointer; color: var(--ink); font-weight: 800; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

.kindness-section { padding: 22px 0 80px; }
.kindness-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; background: linear-gradient(135deg, #4fa57e, #4f93b6); color: #fff; padding: 32px 38px; border-radius: 32px; box-shadow: 0 18px 40px rgba(54,116,113,.2); }
.kindness-card h2 { margin: 0 0 7px; font-size: clamp(25px, 3vw, 36px); }
.kindness-card p { margin: 0; opacity: .9; }
.kindness-icon { font-size: 48px; }
.site-footer { background: #2f4257; color: rgba(255,255,255,.86); padding: 30px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-inner p { margin: 0; }

@media (max-width: 920px) {
  .hero-grid, .write-grid { grid-template-columns: 1fr; }
  .hero-board { max-width: 610px; width: 100%; margin-inline: auto; min-height: 420px; }
  .write-intro { position: static; }
  .steps-grid, .notes-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: 1fr; }
  .wall-toolbar { grid-template-columns: 1fr 170px; }
  .result-count { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 28px, 1160px); }
  .section { padding: 66px 0; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { font-size: 12px; }
  .nav-toggle { display: grid; place-items: center; }
  .main-nav { display: none; position: absolute; top: 68px; left: 14px; right: 14px; background: #fff; box-shadow: var(--shadow); border: 1px solid rgba(48,68,90,.08); border-radius: 18px; padding: 10px; }
  .main-nav.is-open { display: grid; }
  .main-nav a { padding: 12px 14px; }
  .hero { padding-top: 58px; }
  .hero h1 { font-size: clamp(40px, 12vw, 58px); }
  .hero-board { min-height: 350px; padding: 24px; border-radius: 30px 18px 34px 20px; }
  .chalkboard { height: 250px; border-width: 9px; }
  .desk-row { font-size: 34px; gap: 18px; }
  .hero-deco { opacity: .55; }
  .steps-grid, .notes-grid, .two-cols { grid-template-columns: 1fr; }
  .step-card { min-height: 220px; }
  .note-form { padding: 22px 18px; border-radius: 24px; }
  .wall-toolbar { grid-template-columns: 1fr; }
  .result-count { grid-column: auto; }
  .kindness-card { grid-template-columns: 1fr; text-align: center; padding: 28px 22px; }
  .kindness-icon { margin-inline: auto; }
  .kindness-card .btn { width: 100%; }
  .footer-inner { display: grid; text-align: center; justify-content: center; }
}

@media (max-width: 430px) {
  .brand-mark { width: 42px; height: 42px; border-radius: 14px; font-size: 12px; }
  .header-inner { min-height: 68px; }
  .hero-actions .btn { width: 100%; }
  .hero-note { align-items: flex-start; }
  .hero-board { min-height: 315px; }
  .chalkboard { height: 220px; }
  .chalkboard p { font-size: 31px; }
  .desk-row { font-size: 30px; }
  .stat-card strong { font-size: 21px; }
  .pagination { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Pure HTML5 / TXT data mode */
.static-mode-note {
  margin-top: 18px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f4f8ff;
  border: 1px dashed #b9cfe2;
  color: #526377;
  font-size: 14px;
}
.static-mode-note p { margin: 0; }
.static-mode-note code { font-weight: 800; color: #30445a; }
.toolbar-btn {
  border: 0;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 13px;
  background: #30445a;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.toolbar-btn:hover { transform: translateY(-1px); background: #21364b; }
.local-data-hint {
  margin: -12px 0 24px;
  color: #708092;
  font-size: 13px;
  text-align: right;
}
@media (min-width: 921px) {
  .wall-toolbar { grid-template-columns: minmax(220px, 1fr) 170px auto auto; }
}
@media (max-width: 920px) {
  .toolbar-btn { justify-self: start; }
  .local-data-hint { text-align: left; }
}

/* 全校即時 TXT 留言服務 */
.sync-state {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  background: #edf8f1;
  color: #2c7b57;
  border: 1px solid #cde9d8;
}
.sync-state[data-mode="busy"] { background: #fff8df; color: #8d701a; border-color: #eedf9e; }
.sync-state[data-mode="error"] { background: #fff0f0; color: #b13e47; border-color: #f0c8cc; }
.server-mode-note { background: #effaf5; border-color: #a8d7c2; }
.submit-btn:disabled { opacity: .65; cursor: wait; }

@media (max-width: 920px) {
  .sync-state { justify-self: start; }
}
