:root {
  color-scheme: light;
  --ink: #242a31;
  --muted: #78818a;
  --faint: #a0a8b0;
  --surface: rgba(250, 251, 252, .88);
  --surface-solid: #f7f8f9;
  --surface-soft: rgba(233, 237, 240, .82);
  --line: rgba(69, 81, 93, .12);
  --accent: #647582;
  --accent-strong: #435867;
  --accent-soft: #dce4e9;
  --good: #627a6b;
  --warn: #9a7854;
  --danger: #9a6668;
  --shadow: 0 18px 55px rgba(32, 40, 47, .12);
  --glass: rgba(247, 249, 250, .68);
  font-family: "Clear Han Serif", "Noto Serif SC", "Songti SC", serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background: #e8ebee;
  font-family: "Clear Han Serif", "Noto Serif SC", "Songti SC", serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8ebed;
  --muted: #a9b1b7;
  --faint: #818b93;
  --surface: rgba(42, 49, 55, .9);
  --surface-solid: #2b3238;
  --surface-soft: rgba(56, 64, 71, .78);
  --line: rgba(218, 227, 233, .11);
  --accent: #b0bdc6;
  --accent-strong: #d0dbe1;
  --accent-soft: #3c4952;
  --good: #9bb7a3;
  --warn: #d0b28d;
  --danger: #d39a9d;
  --shadow: 0 18px 55px rgba(0, 0, 0, .3);
  --glass: rgba(47, 55, 62, .72);
}

button, input, textarea, select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(110, 137, 153, .5);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.stage {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 22px;
}

.login-view, .phone-view {
  position: relative;
  width: min(100%, 430px);
  height: min(932px, calc(100dvh - 44px));
  min-height: 680px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 38px;
  background:
    radial-gradient(ellipse at 15% 8%, rgba(255, 255, 255, .82), transparent 48%),
    linear-gradient(155deg, #e8ecef, #cbd2d8 52%, #e6e9eb);
  box-shadow: var(--shadow);
}

body[data-theme="dark"] .login-view,
body[data-theme="dark"] .phone-view {
  border-color: rgba(255, 255, 255, .08);
  background:
    radial-gradient(ellipse at 10% 6%, rgba(113, 125, 135, .28), transparent 49%),
    linear-gradient(155deg, #343b41, #242a2f 55%, #343b40);
}

.login-view {
  display: block;
  overflow-y: auto;
  padding: 28px;
  scrollbar-width: thin;
}

.login-card {
  width: 100%;
  max-width: 350px;
  margin: 0 auto;
  padding: 34px 28px 26px;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 30px;
  background: var(--glass);
  box-shadow: 0 22px 55px rgba(41, 50, 58, .1);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
  text-align: center;
}

.academy-mark {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 17px;
  place-items: center;
  border: 1px solid rgba(87, 105, 119, .22);
  border-radius: 21px;
  color: var(--accent-strong);
  background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(213,221,226,.7));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 8px 18px rgba(58,69,78,.12);
  font-size: 30px;
  font-weight: 600;
}

.academy-name, .app-overline {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .1em;
}

.login-card h1 {
  margin: 7px 0 4px;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: .06em;
}

.login-subtitle {
  margin: 0 0 25px;
  color: var(--muted);
  font-size: 13px;
}

.login-form, .form-stack {
  display: grid;
  gap: 14px;
  text-align: left;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

input, textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface-solid);
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input::placeholder, textarea::placeholder { color: var(--faint); }

.form-message {
  min-height: 16px;
  margin: -3px 0;
  color: var(--danger);
  font-size: 12px;
}

.primary-button, .secondary-button, .quiet-button, .danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.primary-button {
  color: #f8fafb;
  background: #586b78;
  box-shadow: 0 7px 16px rgba(58, 73, 83, .17);
}
body[data-theme="dark"] .primary-button { color: #1e252a; background: #bdc9d0; }
.secondary-button { border-color: var(--line); background: var(--surface-soft); }
.quiet-button { border-color: var(--line); background: transparent; color: var(--muted); }
.danger-button { color: var(--danger); border-color: rgba(154,102,104,.2); background: rgba(154,102,104,.07); }
.primary-button:hover, .secondary-button:hover, .quiet-button:hover, .danger-button:hover { transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled, .quiet-button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.demo-entry { width: 100%; margin-top: 10px; }
.prototype-note { margin: 14px 0 0; color: var(--faint); font-size: 11px; line-height: 1.65; }
.rank-draw-card { margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.24); text-align: left; }
.rank-draw-heading, .study-course-heading, .study-time-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rank-draw-heading h2 { margin: 0; font-size: 14px; }
.rank-draw-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.rank-draw-count { padding: 5px 9px; border-radius: 999px; color: var(--accent-strong); background: var(--accent-soft); font: 600 11px Arial,sans-serif; white-space: nowrap; }
.rank-draw-results { display: grid; gap: 6px; margin-top: 12px; }
.rank-result { display: flex; min-height: 43px; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); text-align: left; cursor: pointer; }
.rank-result > span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; color: var(--accent-strong); background: var(--accent-soft); }
.rank-result strong { flex: 1; font-size: 10px; font-weight: 600; }
.rank-result small { color: var(--muted); font-size: 9px; }
.rank-result.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(100,117,130,.13); }
.rank-result:disabled { cursor: default; }
.rank-draw-actions { display: flex; gap: 7px; margin-top: 10px; }
.rank-draw-actions button { min-height: 37px; flex: 1; padding: 6px 7px; font-size: 10px; }
.rank-draw-card .tiny { min-height: 15px; margin: 8px 0 0; }

.phone-view {
  --phone-pad-top: max(12px, env(safe-area-inset-top));
  color: var(--ink);
  background:
    radial-gradient(ellipse at 18% 7%, rgba(255,255,255,.74), transparent 48%),
    radial-gradient(ellipse at 88% 62%, rgba(188,199,206,.34), transparent 45%),
    linear-gradient(145deg, #e2e6e9 0%, #ccd3d8 54%, #e2e6e8 100%);
  isolation: isolate;
}

body[data-theme="dark"] .phone-view {
  background:
    radial-gradient(ellipse at 18% 7%, rgba(131,144,154,.26), transparent 48%),
    radial-gradient(ellipse at 88% 62%, rgba(89,101,111,.2), transparent 45%),
    linear-gradient(145deg, #313940 0%, #242a30 54%, #333a40 100%);
}

.wallpaper-glow {
  position: absolute;
  z-index: -1;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}
.wallpaper-glow-a { top: 17%; left: -34%; background: rgba(255,255,255,.62); }
.wallpaper-glow-b { right: -48%; bottom: 9%; background: rgba(135,153,166,.22); }

.system-bar {
  position: absolute;
  z-index: 10;
  top: var(--phone-pad-top);
  right: 25px;
  left: 25px;
  display: flex;
  height: 25px;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  color: var(--ink);
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
}
.system-time { letter-spacing: .02em; }
.system-status { display: flex; align-items: center; gap: 7px; }
.signal-icon { display: inline-flex; height: 12px; align-items: end; gap: 2px; }
.signal-icon i { display: block; width: 3px; border-radius: 2px; background: currentColor; }
.signal-icon i:nth-child(1) { height: 4px; }
.signal-icon i:nth-child(2) { height: 7px; }
.signal-icon i:nth-child(3) { height: 9px; }
.signal-icon i:nth-child(4) { height: 12px; }
.wifi-icon { font-size: 16px; transform: rotate(45deg); }
.battery { position: relative; display: inline-flex; width: 21px; height: 11px; padding: 1.5px; border: 1px solid currentColor; border-radius: 3px; }
.battery::after { position: absolute; top: 3px; right: -3px; width: 2px; height: 4px; border-radius: 0 2px 2px 0; background: currentColor; content: ""; }
.battery span { width: 86%; border-radius: 1px; background: currentColor; }
.battery-percent { margin-left: -4px; font-size: 10px; font-weight: 600; }

.dynamic-island {
  position: absolute;
  z-index: 11;
  top: var(--phone-pad-top);
  left: 50%;
  width: 92px;
  height: 25px;
  transform: translateX(-50%);
  border-radius: 20px;
  background: rgba(25, 29, 32, .93);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.dynamic-island span {
  position: absolute;
  top: 8px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #536e78, #15191d 72%);
}

.system-actions { position: absolute; z-index: 9; top: 50px; right: 21px; display: flex; gap: 8px; }
.glass-button {
  display: inline-grid;
  min-width: 38px;
  min-height: 38px;
  place-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 14px;
  color: var(--ink);
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 5px 15px rgba(34,43,51,.08);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  cursor: pointer;
}
.theme-toggle { font-size: 17px; }

.home-screen, .app-screen {
  position: absolute;
  inset: 0;
  padding-top: calc(var(--phone-pad-top) + 53px);
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}
.home-screen { overflow: auto; scrollbar-width: none; }
.home-screen::-webkit-scrollbar, .app-content::-webkit-scrollbar { display: none; }
.home-content { padding: 0 21px 28px; }

.home-greeting { margin: 2px 0 15px; padding-right: 92px; }
.home-date { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.home-greeting h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: .04em; }
.home-caption { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.52);
  border-radius: 22px;
  background: var(--glass);
  box-shadow: 0 8px 24px rgba(38,48,57,.08);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 18px;
  color: var(--accent-strong);
  background: linear-gradient(145deg, #fff, #d9e0e4);
  font-size: 18px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-main { min-width: 0; flex: 1; }
.profile-name-row { display: flex; align-items: center; gap: 7px; }
.profile-name { overflow: hidden; margin: 0; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.rank-badge, .status-pill, .tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.22);
  font-size: 10px;
  white-space: nowrap;
}
.rank-badge { color: var(--accent-strong); background: var(--accent-soft); letter-spacing: .08em; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 5px 8px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.profile-edit { min-width: 35px; min-height: 35px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; cursor: pointer; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 20px 2px 11px; }
.section-heading h2 { margin: 0; font-size: 15px; font-weight: 600; }
.section-heading span { color: var(--faint); font-size: 11px; }

.app-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 7px; }
.app-icon-button {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: center;
}
.app-icon {
  position: relative;
  display: grid;
  width: 55px;
  height: 55px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 19px;
  color: #53636e;
  background:
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(220,226,230,.76));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 7px 16px rgba(52,63,71,.12);
  font-family: Arial, sans-serif;
  font-size: 23px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.app-icon-button:hover .app-icon { transform: translateY(-2px); box-shadow: inset 0 1px 0 #fff, 0 11px 20px rgba(52,63,71,.16); }
.app-icon-label { max-width: 74px; overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.app-icon-button.is-locked { opacity: .48; cursor: default; }
.app-icon-button.is-locked .app-icon { filter: grayscale(.6); }
.app-icon-button.is-locked:hover .app-icon { transform: none; }
.locked-mark { position: absolute; right: -4px; bottom: -3px; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; color: #fff; background: #737d84; font-size: 10px; }

.announcement-card, .home-note, .surface-card, .list-card, .detail-card, .wallet-card, .empty-state, .module-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(37,47,55,.045);
}
.announcement-card { padding: 14px; }
.announcement-row { display: flex; align-items: flex-start; gap: 10px; }
.announcement-symbol { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: var(--accent-strong); background: var(--accent-soft); }
.announcement-title { margin: 0; font-size: 12px; font-weight: 600; }
.announcement-copy { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.home-note { margin-top: 13px; padding: 12px 14px; color: var(--muted); font-size: 11px; line-height: 1.65; }

.app-screen { display: flex; flex-direction: column; }
.phone-view.has-app .system-actions { display: none; }
.app-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 17px 12px;
}
.back-button { font-family: Arial, sans-serif; font-size: 27px; line-height: 1; }
.app-heading { display: flex; min-width: 0; flex: 1; align-items: center; gap: 10px; }
.app-mark { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(255,255,255,.55); border-radius: 14px; background: var(--glass); font-family: Arial,sans-serif; font-size: 17px; }
.app-heading h2 { overflow: hidden; margin: 2px 0 0; font-size: 18px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.app-overline { font-size: 9px; letter-spacing: .08em; }
.app-menu-button { font-size: 13px; letter-spacing: .08em; }
.app-content { min-height: 0; flex: 1; overflow: auto; padding: 0 17px 25px; scrollbar-width: none; }

.welcome-panel { padding: 15px; border: 1px solid rgba(255,255,255,.52); border-radius: 20px; background: var(--glass); }
.welcome-panel h3 { margin: 0 0 5px; font-size: 16px; font-weight: 600; }
.welcome-panel p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.action-row .primary-button, .action-row .secondary-button, .action-row .quiet-button { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.segmented { display: flex; gap: 4px; overflow-x: auto; margin: 14px 0; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(120,132,140,.08); scrollbar-width: none; }
.segmented button { min-height: 33px; flex: 1 0 auto; padding: 5px 9px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.segmented button.active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 7px rgba(35,43,50,.08); }
.section-title { margin: 17px 2px 8px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.stack { display: grid; gap: 9px; }
.surface-card, .list-card, .detail-card, .module-card { padding: 13px; }
.list-card { display: flex; align-items: center; gap: 11px; }
.list-copy { min-width: 0; flex: 1; }
.list-title { margin: 0; font-size: 13px; font-weight: 600; }
.list-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.list-action { min-height: 33px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 11px; color: var(--accent-strong); background: var(--surface-soft); font-size: 11px; cursor: pointer; }
.empty-state { padding: 22px 16px; text-align: center; }
.empty-symbol { display: grid; width: 42px; height: 42px; margin: 0 auto 10px; place-items: center; border-radius: 15px; color: var(--accent); background: var(--accent-soft); font-size: 19px; }
.empty-state h3 { margin: 0; font-size: 14px; font-weight: 600; }
.empty-state p { max-width: 270px; margin: 6px auto 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.status-pill { font-size: 10px; }
.status-pill.pending { color: var(--warn); }
.status-pill.complete { color: var(--good); }
.status-pill.locked { color: var(--danger); }
.subtle { color: var(--muted); }
.tiny { color: var(--faint); font-size: 10px; line-height: 1.6; }
.body-copy { color: var(--muted); font-size: 12px; line-height: 1.75; white-space: pre-wrap; }
.body-copy p { margin: 0 0 8px; }
.body-copy p:last-child { margin-bottom: 0; }
.divider { height: 1px; margin: 11px 0; background: var(--line); }
.fee-row, .data-row, .ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.data-row { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.data-row:last-child { border-bottom: 0; }
.ledger-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-amount { font-family: Arial, sans-serif; font-size: 13px; font-weight: 600; }
.ledger-amount.debit { color: var(--danger); }
.ledger-amount.credit { color: var(--good); }
.wallet-card { padding: 17px; border-color: rgba(255,255,255,.42); background: linear-gradient(145deg, rgba(75,91,103,.93), rgba(104,119,129,.82)); color: #f2f5f6; }
.wallet-label { color: rgba(245,248,249,.72); font-size: 11px; }
.wallet-balance { margin: 5px 0 13px; font-family: Arial,sans-serif; font-size: 31px; font-weight: 500; letter-spacing: -.03em; }
.wallet-foot { display: flex; justify-content: space-between; gap: 10px; color: rgba(245,248,249,.75); font-size: 10px; }
.post-card { padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.post-head { display: flex; align-items: center; gap: 8px; }
.mini-avatar { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: 11px; color: var(--accent-strong); background: var(--accent-soft); font-size: 12px; }
.post-head-copy { min-width: 0; flex: 1; }
.post-author { margin: 0; font-size: 11px; font-weight: 600; }
.post-time { margin: 3px 0 0; color: var(--faint); font-size: 10px; }
.post-body { margin: 11px 0; font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-actions { display: flex; align-items: center; gap: 11px; border-top: 1px solid var(--line); padding-top: 9px; }
.post-actions button { min-height: 28px; padding: 3px 7px; border: 0; color: var(--muted); background: transparent; font-size: 10px; cursor: pointer; }
.comment-list { display: grid; gap: 6px; margin-top: 10px; }
.comment { padding: 8px 9px; border-radius: 11px; color: var(--muted); background: var(--surface-soft); font-size: 11px; line-height: 1.6; }
.chat-list { display: grid; gap: 8px; }
.chat-room { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; text-align: left; }
.chat-room:hover, .list-card:hover { border-color: rgba(100,117,130,.28); }
.chat-bubble { max-width: 82%; margin: 8px 0; padding: 9px 11px; border-radius: 15px; background: var(--surface); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.chat-bubble.mine { margin-left: auto; background: var(--accent-soft); }
.line-chat-shell { display: flex; min-height: calc(100% - 30px); flex-direction: column; margin: 0 -4px; background: rgba(211,213,215,.42); }
.line-chat-header { display: flex; min-height: 60px; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid rgba(80,88,94,.12); background: rgba(245,245,245,.78); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.line-back { width: 28px; height: 34px; border: 0; color: #58636b; background: transparent; font: 28px/1 Arial,sans-serif; cursor: pointer; }
.line-chat-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #4e5e68; background: #d8dfe3; font-size: 14px; }
.line-chat-heading { display: grid; min-width: 0; flex: 1; gap: 3px; }
.line-chat-heading strong { overflow: hidden; color: #30363a; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.line-chat-heading small { color: #7d858a; font: 10px Arial,sans-serif; }
.line-chat-more { color: #737b81; font: 13px Arial,sans-serif; letter-spacing: 2px; }
.line-chat-shell .action-row { padding: 0 9px; }
.chat-image { display: block; max-width: 100%; max-height: 180px; margin-top: 5px; border-radius: 10px; }
.chat-history { min-height: 34vh; max-height: 48vh; overflow: auto; margin-top: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 18px; background-color: var(--surface-soft); background-position: center; background-size: cover; }
.line-chat-history { flex: 1; min-height: 36vh; max-height: none; margin: 0; padding: 14px 11px; border: 0; border-radius: 0; background-color: #d3d3d5; }
.line-chat-history .chat-bubble { width: fit-content; max-width: 82%; padding: 7px 10px; border: 0; border-radius: 13px; color: #111; background: #fff; box-shadow: none; }
.line-chat-history .chat-bubble.mine { margin-left: auto; color: #444; background: #e9e9e9; }
.line-chat-history .chat-bubble .tiny { color: #929292; font: 9px Arial,sans-serif; text-align: right; }
.line-chat-history .empty-state { border: 0; background: rgba(255,255,255,.42); box-shadow: none; }
.line-chat-shell .chat-compose { position: sticky; bottom: 0; align-items: center; margin: auto 0 0; padding: 9px 8px calc(9px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(80,88,94,.12); background: rgba(211,213,215,.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.line-chat-shell .chat-compose textarea { min-height: 38px; max-height: 88px; border-color: rgba(80,88,94,.08); border-radius: 999px; color: #222; background: #f5f5f5; }
.line-chat-shell .chat-compose .secondary-button { min-width: 37px; min-height: 37px; border: 0; border-radius: 50%; color: #626b72; background: #eceeef; }
.line-send-button { min-width: 38px !important; min-height: 38px !important; padding: 0 !important; border-radius: 50% !important; color: #fff !important; background: #687a84 !important; font-family: Arial,sans-serif; }
body[data-theme="dark"] .line-chat-shell { background: rgba(52,59,64,.65); }
body[data-theme="dark"] .line-chat-header { background: rgba(48,55,60,.82); }
body[data-theme="dark"] .line-chat-heading strong { color: #e7ecef; }
body[data-theme="dark"] .line-chat-history { background-color: #454c51; }
body[data-theme="dark"] .line-chat-history .chat-bubble { color: #25292c; }
body[data-theme="dark"] .line-chat-history .chat-bubble.mine { color: #303438; }
body[data-theme="dark"] .line-chat-shell .chat-compose { background: rgba(61,68,73,.94); }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-compose { position: sticky; bottom: -25px; display: flex; gap: 7px; align-items: end; margin: 14px -1px 0; padding: 9px 0 3px; background: linear-gradient(180deg, transparent, var(--surface-solid) 20%); }
.chat-compose textarea { min-height: 39px; max-height: 100px; flex: 1; padding: 9px 11px; border-radius: 14px; }
.chat-compose button { min-width: 40px; min-height: 40px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.module-card { text-align: left; cursor: pointer; }
.module-card:hover { border-color: rgba(100,117,130,.3); }
.module-symbol { display: grid; width: 31px; height: 31px; margin-bottom: 8px; place-items: center; border-radius: 11px; color: var(--accent-strong); background: var(--accent-soft); }
.module-card strong { display: block; font-size: 12px; font-weight: 600; }
.module-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.study-intro { margin-bottom: 12px; padding: 15px; border: 1px solid rgba(255,255,255,.5); border-radius: 18px; background: var(--glass); }
.study-intro h3, .study-course h3, .study-player h3 { margin: 5px 0; font-size: 15px; }
.study-intro > p:last-child, .study-grade-note { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.study-course { margin: 9px 0; }
.study-course-heading h3 { margin: 3px 0; }
.study-course-heading > strong { color: var(--accent-strong); font: 600 17px Arial,sans-serif; }
.progress-track { height: 7px; overflow: hidden; margin: 9px 0; border-radius: 99px; background: var(--surface-soft); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #748995, #a9b7bf); transition: width .2s ease; }
.study-lessons { display: grid; gap: 7px; margin-top: 12px; }
.study-lesson { display: flex; align-items: center; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 13px; }
.study-lesson .list-copy strong { display: block; font-size: 10px; }
.lesson-play { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border-radius: 9px; color: var(--accent-strong); background: var(--accent-soft); font-size: 10px; }
.study-player { margin-top: 8px; }
.study-placeholder, .study-video { display: grid; width: 100%; aspect-ratio: 16 / 9; margin: 13px 0; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, #dce2e6, #bbc5cb); object-fit: contain; }
.study-placeholder { color: #485761; text-align: center; }
.study-placeholder span { font-size: 32px; }
.study-placeholder strong, .study-placeholder small { display: block; }
.study-placeholder small { margin-top: 4px; font-size: 9px; }
.study-player-controls { display: flex; gap: 7px; }
.study-player-controls button { min-height: 36px; flex: 1; padding: 5px 7px; font-size: 10px; }
.study-time-row { margin-top: 10px; color: var(--muted); font: 10px Arial,sans-serif; }
.study-time-row strong { color: var(--accent-strong); }
.study-grade-note { padding: 9px 10px; border-radius: 11px; background: var(--surface-soft); }
.simple-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.simple-table th, .simple-table td { min-width: 70px; padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.simple-table th { color: var(--muted); font-weight: 500; background: var(--surface-soft); }
.simple-table tr:last-child td { border-bottom: 0; }
.back-link { min-height: 34px; padding: 5px 0; border: 0; color: var(--accent-strong); background: transparent; cursor: pointer; }
.warning-box { padding: 11px 12px; border: 1px solid rgba(154,120,84,.2); border-radius: 13px; color: var(--warn); background: rgba(154,120,84,.07); font-size: 11px; line-height: 1.65; }
.error-box { padding: 11px 12px; border: 1px solid rgba(154,102,104,.2); border-radius: 13px; color: var(--danger); background: rgba(154,102,104,.07); font-size: 11px; line-height: 1.65; }
.phone-dock {
  position: absolute;
  z-index: 12;
  right: 25px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 25px;
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-around;
  padding: 7px;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 22px;
  box-shadow: 0 9px 24px rgba(34,44,52,.12);
}
.phone-dock button { display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 15px; color: var(--accent-strong); background: rgba(255,255,255,.26); font-family: Arial,sans-serif; font-size: 20px; cursor: pointer; }
.phone-dock button:hover { background: rgba(255,255,255,.52); }
.home-indicator { position: absolute; z-index: 13; bottom: max(7px, env(safe-area-inset-bottom)); left: 50%; width: 95px; height: 4px; transform: translateX(-50%); border-radius: 5px; background: rgba(36,42,49,.66); }
body[data-theme="dark"] .home-indicator { background: rgba(235,240,243,.65); }

.modal {
  width: min(390px, calc(100vw - 28px));
  max-height: min(85dvh, 780px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--ink);
  background: var(--surface-solid);
  box-shadow: 0 24px 70px rgba(0,0,0,.24);
}
.modal::backdrop { background: rgba(25,31,36,.42); backdrop-filter: blur(5px); }
.modal-panel { padding: 20px; }
.modal-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.modal-header h2 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.modal-close { min-width: 34px; min-height: 34px; border: 0; border-radius: 11px; color: var(--muted); background: var(--surface-soft); cursor: pointer; }
.modal-actions { display: flex; justify-content: end; gap: 8px; margin-top: 15px; }
.toast {
  position: absolute;
  z-index: 30;
  right: 30px;
  bottom: 99px;
  left: 30px;
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 14px;
  color: #f5f7f8;
  background: rgba(42,51,58,.91);
  box-shadow: 0 10px 24px rgba(20,28,33,.2);
  font-size: 11px;
  text-align: center;
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 520px) {
  .stage { display: block; min-height: 100dvh; padding: 0; }
  .login-view, .phone-view { width: 100%; height: 100dvh; min-height: 560px; border: 0; border-radius: 0; box-shadow: none; }
  .login-view { padding: 22px; }
  .home-content { padding-right: 18px; padding-left: 18px; }
  .app-header { padding-right: 14px; padding-left: 14px; }
  .app-content { padding-right: 14px; padding-left: 14px; }
}

@media (max-height: 730px) and (min-width: 521px) {
  .stage { padding: 12px; }
  .login-view, .phone-view { height: calc(100dvh - 24px); min-height: 620px; }
  .home-screen, .app-screen { padding-top: 63px; }
  .app-grid { gap: 10px 6px; }
  .app-icon { width: 49px; height: 49px; border-radius: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.admin-terminal { width: min(900px, calc(100vw - 24px)); max-width: 900px; max-height: min(92dvh, 980px); }
.admin-shell { display: flex; min-height: min(78dvh, 760px); flex-direction: column; padding: 22px; }
.admin-shell .modal-header { align-items: center; margin-bottom: 12px; }
.admin-shell .modal-header h2 { margin-top: 3px; font-size: 20px; }
.admin-warning { padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--surface-soft); font-size: 10px; line-height: 1.6; }
.admin-main-tabs, .admin-content-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); scrollbar-width: none; }
.admin-main-tabs button, .admin-content-tabs button { min-height: 34px; flex: 0 0 auto; padding: 6px 12px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.admin-main-tabs button.active, .admin-content-tabs button.active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 8px rgba(35,43,50,.1); }
.admin-message { min-height: 17px; margin: 0 2px 5px; color: var(--good); font-size: 11px; }
.admin-message.is-error { color: var(--danger); }
.admin-content { min-height: 0; flex: 1; overflow: auto; padding: 0 2px 5px; scrollbar-width: thin; }
.admin-content-tabs { margin-top: 0; }
.admin-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 9px 0; }
.admin-section-heading h3 { margin: 0; font-size: 14px; }
.admin-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.admin-section-heading > .secondary-button { min-height: 34px; padding: 6px 10px; font-size: 10px; white-space: nowrap; }
.admin-section-heading.compact { margin-top: 19px; }
.admin-form { margin: 10px 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 11px; }
.admin-form-grid label { min-width: 0; }
.admin-form-grid input, .admin-form-grid select { min-height: 38px; padding: 8px 10px; border-radius: 11px; font-size: 11px; }
.admin-form-grid textarea { min-height: 76px; padding: 9px 10px; border-radius: 11px; font-size: 11px; line-height: 1.6; }
.admin-form-grid .admin-wide { grid-column: 1 / -1; }
.admin-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.admin-form-actions button { min-height: 35px; padding: 6px 11px; font-size: 10px; }
.admin-record-list { display: grid; gap: 7px; }
.admin-record { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.admin-record-copy { min-width: 0; flex: 1; }
.admin-record-copy strong, .admin-record-copy span, .admin-record-copy small { display: block; overflow: hidden; text-overflow: ellipsis; }
.admin-record-copy strong { font-size: 11px; }
.admin-record-copy span, .admin-record-copy small { margin-top: 3px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.admin-record-actions { display: flex; flex: 0 0 auto; gap: 5px; }
.admin-record-actions .list-action { min-height: 30px; padding: 4px 8px; }
.admin-empty { padding: 18px 12px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); font-size: 11px; text-align: center; }
.admin-target-select { margin: 8px 0 11px; }
.admin-target-select select { min-height: 38px; padding: 8px 10px; border-radius: 11px; font-size: 11px; }
.admin-help { margin: 7px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
@media (max-width: 600px) {
  .admin-shell { min-height: 84dvh; padding: 16px 13px; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-form-grid .admin-wide { grid-column: auto; }
  .admin-record { align-items: flex-start; }
  .admin-record-actions { flex-direction: column; }
}
