/* Imperial Liquid Glass — the same look as the Android app: smoky burgundy glass on a dark stage,
   a gold rim catching light at the top-left, soft sheen and deep shadows. Tokens mirror ui/theme/Tokens.kt. */

@font-face {
  font-family: "Cormorant";
  src: url("assets/fonts/cormorant-garamond.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg: #160C0F;
  --stage-top: #241014;
  --stage-bottom: #100809;
  --text: #F1E9E8;
  --text-2: #BFB1B2;
  --text-3: #928487;
  --gold: #B08A32;
  --soft-gold: #D8BD82;
  --gold-ink: #2A1F08;
  --gold-top: #E2BF73;
  --gold-bottom: #A9792F;
  --rose: #E9B1B9;
  --rose-ink: #3B1218;
  --burgundy: #43191E;
  --burgundy-bright: #6E2330;
  --error: #EF8A80;
  --success: #9CC8A4;
  --hairline: rgba(216, 189, 130, .14);

  --panel-top: rgba(74, 29, 37, .42);
  --panel-bottom: rgba(40, 18, 22, .34);
  --velvet-top: rgba(102, 34, 46, .55);
  --velvet-bottom: rgba(58, 20, 27, .45);
  --accent-top: rgba(146, 42, 56, .70);
  --accent-bottom: rgba(90, 24, 32, .60);
  --shadow: rgba(5, 2, 3, .62);
  --gold-glow: rgba(217, 164, 65, .40);
  --rose-glow: rgba(194, 58, 74, .35);

  --r-xs: 8px; --r-s: 14px; --r-m: 16px; --r-l: 22px; --r-xl: 26px;
  --gutter: 16px;
  --bar-h: 76px;
  --bar-margin: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --serif: "Cormorant", "Cormorant Garamond", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-emph: cubic-bezier(.05, .7, .1, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0; min-height: 100dvh; color: var(--text); background: var(--bg);
  font: 400 15px/1.45 var(--sans); letter-spacing: .01em;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--soft-gold); }
img { max-width: 100%; }
.noscript { padding: 24px; text-align: center; }

/* The stage: warm light from the upper right, an ember at the lower left. Fixed layer (iOS ignores background-attachment). */
.stage {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 92% 8%, rgba(110, 35, 48, .40), transparent 62%),
    radial-gradient(circle at 0% 78%, rgba(74, 26, 16, .20), transparent 55%),
    linear-gradient(180deg, var(--stage-top), var(--bg) 50%, var(--stage-bottom));
}

#view { outline: none; padding-top: var(--safe-t); }
#view.with-bar { padding-bottom: calc(var(--bar-h) + var(--bar-margin) * 2 + var(--safe-b) + 16px); }
.page { padding: 0 var(--gutter); animation: page-in .26s var(--ease-emph); }
@keyframes page-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }

/* ---- Typography ---------------------------------------------------------------------------- */
.serif { font-family: var(--serif); font-weight: 600; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
.display { font-size: 34px; line-height: 1.12; }
.headline { font-size: 25px; line-height: 1.2; }
.title-l { font-family: var(--serif); font-weight: 600; font-size: 23px; line-height: 1.2; }
.title-m { font-weight: 500; font-size: 16px; line-height: 1.35; }
.title-s { font-weight: 500; font-size: 14px; }
.body-s { font-size: 12.5px; line-height: 1.35; }
.label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--soft-gold); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.gold { color: var(--soft-gold); }
.rose { color: var(--rose); }
.error-text { color: var(--error); }

/* ---- Glass ----------------------------------------------------------------------------------- */
.glass {
  position: relative;
  border-radius: var(--r-l);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 10px 28px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .07), inset 0 0 22px rgba(243, 201, 138, .07);
}
/* Rim: bright gold where light falls, fading along the edge, a warm catch bottom-right. */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgba(216, 189, 130, .62), rgba(176, 138, 50, .22) 35%, rgba(233, 177, 185, .08) 70%, rgba(176, 138, 50, .34));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* Sheen on the upper part, as on a curved pane. */
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .02) 22%, transparent 50%);
}
.glass.velvet { background: linear-gradient(180deg, var(--velvet-top), var(--velvet-bottom)); }
.glass.accent { background: linear-gradient(180deg, var(--accent-top), var(--accent-bottom)); }
.glass.highlight { box-shadow: 0 10px 28px var(--shadow), 0 0 22px rgba(217, 164, 65, .18), inset 0 1px 0 rgba(255, 255, 255, .08); }
.glass.gold-fill { background: linear-gradient(180deg, var(--gold-top), var(--gold-bottom)); color: var(--gold-ink); box-shadow: 0 6px 18px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,.25); }
.glass > * { position: relative; z-index: 1; }

.card { margin: 0 0 12px; overflow: hidden; }
.card-pad { padding: 16px; }
.pressable { cursor: pointer; transition: transform .17s var(--ease), filter .17s var(--ease); }
.pressable:active { transform: scale(.97); filter: brightness(1.12); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Top bar --------------------------------------------------------------------------------- */
.topbar { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 0 4px; }
.topbar .grow { flex: 1; min-width: 0; }
.topbar h1 { font-size: 30px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 13px; color: var(--text-2); }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:active { background: rgba(216, 189, 130, .12); }
.icon-btn svg { width: 24px; height: 24px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 600; font-size: 14px; color: var(--soft-gold); border: 1.5px solid transparent; cursor: pointer;
  background: radial-gradient(circle, var(--burgundy-bright), var(--burgundy) 70%, #2A0F14) padding-box,
              linear-gradient(135deg, var(--soft-gold), rgba(233, 177, 185, .7), var(--gold)) border-box;
  box-shadow: 0 0 14px var(--rose-glow);
}
.avatar.large { width: 72px; height: 72px; font-size: 26px; }

/* ---- Bottom bar: floating frosted glass ------------------------------------------------------ */
.tabbar {
  position: fixed; z-index: 20; left: var(--bar-margin); right: var(--bar-margin);
  bottom: calc(var(--bar-margin) + var(--safe-b)); height: var(--bar-h); border-radius: 30px;
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px;
  background: linear-gradient(180deg, rgba(42, 17, 22, .62), rgba(30, 12, 16, .70));
  -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 14px 34px var(--shadow), inset 0 1px 0 rgba(255,255,255,.08);
}
.tabbar .indicator {
  position: absolute; z-index: 0; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 4);
  border-radius: 22px; transition: transform .26s var(--ease-emph);
}
.tab {
  position: relative; z-index: 1; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-2); font-size: 11px; font-weight: 500; text-decoration: none; transition: color .17s;
}
.tab svg { width: 25px; height: 25px; transition: transform .17s var(--ease); }
.tab.active { color: var(--gold-ink); font-weight: 600; }
.tab.active svg { transform: scale(1.06); }

/* ---- Chips, pills, tags ---------------------------------------------------------------------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px var(--gutter); margin: 0 calc(-1 * var(--gutter)); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-s); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; font-weight: 500; white-space: nowrap;
}
.chip.selected { background: linear-gradient(180deg, var(--gold-top), var(--gold-bottom)); color: var(--gold-ink); box-shadow: 0 4px 16px var(--gold-glow); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.rose { background: linear-gradient(180deg, #F2BEC5, #DE97A2); color: var(--rose-ink); box-shadow: 0 0 10px var(--rose-glow); }
.pill.muted { background: rgba(241, 233, 232, .2); color: var(--text-2); }
.pill.gold { background: linear-gradient(180deg, var(--gold-top), var(--gold-bottom)); color: var(--gold-ink); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  padding: 4px 9px; border-radius: var(--r-xs); font-size: 12px; font-weight: 500; color: var(--soft-gold);
  background: linear-gradient(180deg, rgba(176,138,50,.24), rgba(176,138,50,.07)); border: 1px solid rgba(176,138,50,.55);
}

/* ---- Buttons and fields ---------------------------------------------------------------------- */
.btn {
  min-height: 50px; padding: 0 20px; border: 0; border-radius: var(--r-s); cursor: pointer; width: 100%;
  font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.gold { background: linear-gradient(180deg, var(--gold-top), var(--gold-bottom)); color: var(--gold-ink); box-shadow: 0 6px 18px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.gold:disabled { background: rgba(241, 233, 232, .1); color: var(--text-3); box-shadow: none; cursor: default; }
.btn.ghost { background: transparent; color: var(--text-2); width: auto; min-height: 44px; }
.btn.danger { background: transparent; color: var(--error); border: 1px solid rgba(239, 138, 128, .5); }
.link-btn { border: 0; background: none; padding: 6px 0; color: var(--rose); font-weight: 500; font-size: 14px; cursor: pointer; }
.field {
  width: 100%; min-height: 52px; padding: 14px 16px; border-radius: var(--r-s); outline: none;
  background: rgba(16, 6, 8, .32); border: 1px solid rgba(176, 138, 50, .32); color: var(--text); font-size: 16px;
  transition: border-color .17s, box-shadow .17s;
}
.field:focus { border-color: var(--soft-gold); box-shadow: 0 0 0 3px rgba(216, 189, 130, .15); }
.field::placeholder { color: var(--text-3); }
.field-label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 6px; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-2); }
.search .field { padding-left: 44px; min-height: 48px; }

/* ---- Lists, rows ----------------------------------------------------------------------------- */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; }
.row + .row { border-top: 1px solid var(--hairline); }
.row .grow { flex: 1; min-width: 0; }
.row .chev { width: 20px; height: 20px; color: var(--soft-gold); opacity: .8; flex: none; }
.row-icon { width: 22px; height: 22px; color: var(--soft-gold); flex: none; }
.time-col { width: 64px; flex: none; }
.time-col .start { font-weight: 600; font-size: 16px; }
.time-col .end { font-size: 12.5px; color: var(--text-3); }
.day-head { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; }
.day-head h2 { font-size: 25px; }
.section-label { margin: 22px 0 8px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty .badge-icon { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; }
.empty .badge-icon svg { width: 32px; height: 32px; color: var(--soft-gold); }
.empty h3 { font-size: 25px; color: var(--text); margin-bottom: 8px; }
.stale { display: flex; gap: 8px; align-items: center; padding: 8px 12px; margin: 4px 0; font-size: 12px; color: var(--soft-gold); }

/* Loading skeleton with a slow breathing tone. */
.skeleton { height: 76px; margin-bottom: 12px; animation: breathe 1.8s ease-in-out infinite alternate; }
@keyframes breathe { from { opacity: .45; } to { opacity: .85; } }

/* ---- Home ------------------------------------------------------------------------------------ */
.brand { font-family: var(--serif); font-weight: 600; font-size: 23px; color: var(--soft-gold); }
.hero { position: relative; min-height: 170px; display: flex; align-items: center; margin: 4px calc(-1 * var(--gutter)) 16px; overflow: hidden; }
.hero .text { position: relative; z-index: 1; width: 54%; padding-left: var(--gutter); }
.hero .text .date { font-family: var(--serif); font-weight: 600; font-size: 22px; color: var(--text-2); margin-top: 8px; }
/* The theatre stands to the right and runs off the edge; its left side and base melt into the stage. */
.hero .facade {
  position: absolute; left: 54%; top: 50%; transform: translateY(-50%); width: 74%; max-width: 340px; aspect-ratio: 1200 / 675;
  background: url("assets/facade.png") center / contain no-repeat;
  filter: saturate(.8) brightness(.86) sepia(.08);
  -webkit-mask-image: linear-gradient(to right, transparent, rgba(0,0,0,.35) 12%, #000 38%), linear-gradient(to bottom, rgba(0,0,0,.75), #000 18%, #000 90%, rgba(0,0,0,.45));
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, rgba(0,0,0,.35) 12%, #000 38%), linear-gradient(to bottom, rgba(0,0,0,.75), #000 18%, #000 90%, rgba(0,0,0,.45));
  mask-composite: intersect;
}
.hero .glow { position: absolute; left: 54%; width: 74%; max-width: 340px; aspect-ratio: 1200/675; top: 50%; transform: translateY(-50%);
  background: radial-gradient(circle at 50% 62%, rgba(227, 163, 90, .22), transparent 55%); }
.notice { display: flex; gap: 12px; padding: 8px; margin: 2px 8px; border-radius: var(--r-m); align-items: flex-start; }
.notice.important { background: linear-gradient(180deg, var(--accent-top), var(--accent-bottom)); }
.notice svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.count-badge { min-width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.agenda-row { display: flex; gap: 12px; padding: 8px 16px; }
.agenda-row .t { width: 76px; flex: none; font-family: var(--serif); font-size: 25px; font-weight: 600; }
.tile-icon { width: 46px; height: 46px; border-radius: var(--r-m); display: grid; place-items: center; flex: none; }
.tile-icon svg { width: 24px; height: 24px; color: var(--soft-gold); }
.progress { height: 6px; border-radius: 999px; background: rgba(241, 233, 232, .12); overflow: hidden; margin: 8px 0; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--soft-gold), var(--gold)); transition: width .34s var(--ease-emph); }

/* ---- Schedule ---------------------------------------------------------------------------------- */
.week { display: flex; gap: 8px; overflow-x: auto; padding: 4px var(--gutter); margin: 0 calc(-1 * var(--gutter)); scrollbar-width: none; scroll-behavior: smooth; }
.week::-webkit-scrollbar { display: none; }
.daycell { flex: none; width: 54px; padding: 8px 0; border: 0; border-radius: var(--r-m); text-align: center; cursor: pointer; color: var(--text); }
.daycell .dow { font-size: 12px; color: var(--text-3); }
.daycell .num { font-family: var(--serif); font-weight: 600; font-size: 23px; line-height: 1.1; }
.daycell .dot { width: 4px; height: 4px; border-radius: 50%; margin: 2px auto 0; }
.daycell.today .dot { background: var(--gold); }
.daycell.selected { background: linear-gradient(180deg, var(--accent-top), var(--accent-bottom)); box-shadow: 0 0 16px var(--rose-glow); }
.daycell.selected .dow { color: var(--soft-gold); }
.daycell.nodata .num { color: var(--text-3); }
.item-row { display: flex; padding: 10px 16px; gap: 0; }
.item-row + .item-row { border-top: 1px solid var(--hairline); }
.item-row .details { color: var(--text-2); font-size: 14px; white-space: pre-line; }
.item-row .details.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.tools { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.tools .search { flex: 1; }
.square-btn { width: 48px; height: 48px; border: 0; border-radius: var(--r-s); display: grid; place-items: center; cursor: pointer; color: var(--text-2); flex: none; }
.square-btn svg { width: 22px; height: 22px; }

/* ---- ASUS tabs --------------------------------------------------------------------------------- */
.utabs { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 -8px 4px; }
.utabs button { min-height: 48px; border: 0; background: none; color: var(--text-2); font-weight: 500; font-size: 14px; cursor: pointer; }
.utabs button.active { color: var(--soft-gold); font-weight: 600; }
.utabs::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(176,138,50,.28), transparent); }
.utabs .line {
  position: absolute; bottom: 0; height: 2.5px; width: calc(25% * .64); left: calc(25% * .18); border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--soft-gold), var(--gold)); box-shadow: 0 0 10px var(--gold-glow);
  transition: transform .26s var(--ease-emph);
}
.week-nav { display: flex; align-items: center; gap: 4px; margin: 4px 0; }
.week-nav .grow { flex: 1; text-align: center; font-family: var(--serif); font-weight: 600; font-size: 22px; cursor: pointer; }
select.field { min-height: 44px; padding: 8px 12px; width: auto; font-size: 14px; }

/* ---- Media ------------------------------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { overflow: hidden; border-radius: var(--r-m); cursor: pointer; }
.tile .thumb { aspect-ratio: 1; display: grid; place-items: center; background: rgba(16, 6, 8, .4); }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .thumb svg { width: 40px; height: 40px; color: var(--soft-gold); }
.tile .name { padding: 8px 10px; font-size: 13px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--text-2); margin: 0 0 10px; }
.crumbs button { border: 0; background: none; color: var(--soft-gold); padding: 2px 0; cursor: pointer; }

/* ---- Overlays ---------------------------------------------------------------------------------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(13, 10, 11, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px; animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(440px, 100%); padding: 22px; border-radius: var(--r-xl); background: linear-gradient(180deg, #3A1A20, #26131A); }
.dialog h3 { font-size: 24px; margin-bottom: 8px; }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.dialog .actions .btn { width: auto; min-height: 44px; }
.viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; animation: fade .2s; }
.viewer .bar { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 8px 8px; color: #fff; }
.viewer .stagebox { flex: 1; display: grid; place-items: center; min-height: 0; }
.viewer img, .viewer video { max-width: 100%; max-height: 100%; object-fit: contain; }
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + var(--bar-margin) * 2 + var(--safe-b) + 8px);
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: var(--r-s); background: #3A2A2D; color: var(--text); font-size: 14px;
  box-shadow: 0 8px 24px var(--shadow);
}

/* ---- Login ------------------------------------------------------------------------------------- */
.login { max-width: 440px; margin: 0 auto; padding: 36px 24px 32px; text-align: center; }
.login .emblem { width: 100%; height: 170px; object-fit: contain; filter: drop-shadow(0 0 30px rgba(217, 164, 65, .28)); }
.login .wordmark { font-family: var(--serif); font-weight: 600; font-size: 52px; line-height: 1; margin-top: 18px; }
.login .sub { color: var(--soft-gold); letter-spacing: .5em; font-size: 14px; margin: 6px 0 32px; }
.login form { text-align: left; padding: 24px; border-radius: var(--r-xl); }
.login .note { color: var(--text-2); font-size: 12.5px; margin-top: 18px; }

@media (min-width: 720px) {
  #view { max-width: 720px; margin: 0 auto; }
  .tabbar { max-width: 520px; left: 50%; transform: translateX(-50%); right: auto; width: calc(100% - 24px); }
}
