:root {
  --bg: #f3f5f7; --paper: #fff; --paper-soft: #f1f4f6; --ink: #17242e;
  --muted: #465864; --line: #c8d2da; --primary: #0d6657; --primary-dark: #084f43;
  --mint: #edf6f2; --shadow: none; --radius: 6px;
}
html, body { background: var(--bg); font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; font-size: 16px; line-height: 1.6; letter-spacing: 0; }
html { scroll-padding-top: 88px; }
body { padding-bottom: 0; }
button, input, select, textarea, summary, a { font-family: inherit; letter-spacing: 0; -webkit-tap-highlight-color: transparent; }
button, a, select, summary { touch-action: manipulation; }
button, select, input { min-height: 44px; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #70b4a4; outline-offset: 3px; }
button { transition: background-color .12s ease, border-color .12s ease; }
button:disabled { opacity: .5; }
.portal-icon { width: 21px; height: 21px; display: inline-block; flex-shrink: 0; }
.portal-header { position: sticky; top: 0; z-index: 35; background: #fff; border-bottom: 1px solid var(--line); padding: 0 26px; }
.portal-header__inner { height: 70px; max-width: 1140px; margin: 0 auto; display: flex; align-items: center; gap: 28px; justify-content: space-between; }
.portal-brand { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: #17242e; font-size: 17px; font-weight: 800; white-space: nowrap; cursor: pointer; }
.portal-brand img { object-fit: contain; border-radius: 5px; }
.portal-brand strong { color: #354b59; font-weight: 700; }
.portal-nav { display: flex; gap: 4px; margin-left: auto; }
.portal-nav button { border: 0; background: transparent; color: #354b59; font-size: 15px; font-weight: 700; padding: 9px 14px; border-radius: 5px; }
.portal-nav button.is-active { background: #edf6f2; color: var(--primary); }
.portal-nav button:hover { color: var(--primary); }
.portal-icon-button { width: 44px; height: 44px; min-height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #96a8b3; border-radius: 6px; background: #fff; color: #354b59; cursor: pointer; flex-shrink: 0; }
.portal-icon-button:hover { background: #eff4f3; color: var(--primary); }
.hero { display: grid; grid-template-columns: minmax(0,1fr) 250px; align-items: end; gap: 28px; max-width: 1140px; margin: 0 auto; padding: 28px 0; color: var(--ink); background: none; overflow: visible; }
.hero::before, .hero::after { display: none; }
.hero .eyebrow { color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 6px; letter-spacing: 0; }
.hero h1 { color: #27323a; font-size: 26px; line-height: 1.35; font-weight: 800; }
.hero__meta { display: grid; grid-template-columns: 170px minmax(0,310px); gap: 20px; margin-top: 20px; }
.meta-chip { border: 0; border-radius: 0; background: none; padding: 0; backdrop-filter: none; }
.meta-chip span, .meta-chip label { display: block; font-size: 13px; color: var(--muted); font-weight: 700; margin: 0 0 7px; }
.meta-chip strong { display: flex; align-items: center; font-size: 14px; min-height: 44px; font-weight: 700; color: #283e4d; }
.select-inline { border: 1px solid #96a8b3; background: #fff; color: #283e4d; font-size: 14px; font-weight: 700; min-height: 44px; padding: 10px; border-radius: 5px; }
.hero__visual { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0; border-left: 1px solid #dfe5e8; padding-left: 24px; }
body:not([data-route="home"]) .hero { display: block; padding-top: 16px; padding-bottom: 16px; }
body:not([data-route="home"]) .hero h1,
body:not([data-route="home"]) .hero .eyebrow,
body:not([data-route="home"]) .hero__visual { display: none; }
body:not([data-route="home"]) .hero__meta { margin-top: 0; }
.visual-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 0 12px; background: none; border: 0; border-radius: 0; box-shadow: none; color: #27323b; min-height: 0; backdrop-filter: none; }
.visual-card .portal-icon { color: #465e6d; width: 20px; height: 20px; margin-bottom: 7px; }
.visual-card strong { font-size: 24px; font-weight: 800; }
.visual-card small { font-size: 13px; color: var(--muted); font-weight: 700; }
.page { width: min(1140px,100%); padding: 0 0 60px; }
.panel { border: 0; background: #fff; border-radius: 0; box-shadow: none; padding: 28px; scroll-margin-top: 86px; }
.panel--home { padding: 26px 28px; background: #fff; border: 0; }
.panel--home::before { display: none; }
.panel--home .section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; padding: 0 0 18px; border-bottom: 1px solid var(--line); }
.panel--home .section-title h2 { font-size: 17px; }
.section-title > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.mode-grid--primary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 28px; margin: 0; }
.mode-card { display: flex; align-items: center; gap: 14px; min-height: 92px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 18px 0; background: #fff; color: #25313b; text-decoration: none; }
.mode-card::before { display: none; }
.mode-card:hover { transform: none; box-shadow: none; background: #fafcfc; border-color: var(--line); }
.mode-card__icon { display: inline-grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; background: #e6f1ec; border-radius: 6px; color: #21654f; }
.mode-card__icon .portal-icon { width: 22px; height: 22px; }
.mode-card--admin .mode-card__icon { color: #365b8b; background: #eaf0f8; }
.mode-card--images .mode-card__icon { color: #886025; background: #fbf2e4; }
.mode-card--items .mode-card__icon { color: #70518c; background: #f1eaf6; }
.mode-card__body { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.mode-card__title { font-size: 18px; line-height: 1.4; font-weight: 800; }
.mode-card__desc { font-size: 14px; color: var(--muted); font-weight: 600; line-height: 1.6; }
.mode-arrow { color: #4c6575; width: 19px; height: 19px; }
.rift-entry-card { display: flex; align-items: center; width: 100%; gap: 14px; min-height: 92px; padding: 18px 0 0; border: 0; background: #fff; border-radius: 0; box-shadow: none; color: #293740; }
.rift-entry-card::before { display: none; }
.rift-entry-card:hover { transform: none; box-shadow: none; filter: none; }
.rift-entry-card__mark { flex-shrink: 0; background: #edf2f7; color: #667c94; border: 0; border-radius: 6px; width: 42px; height: 42px; }
.rift-entry-card__body { flex: 1; min-width: 0; gap: 5px; }
.rift-entry-card__title { font-size: 18px; font-weight: 800; line-height: 1.4; }
.rift-entry-card__desc { color: var(--muted); font-size: 14px; font-weight: 600; }
.panel__head { display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 24px; }
.panel__head h2, #riftView .panel__head h2 { font-size: 22px; max-width: none; line-height: 1.4; }
.panel__head p { color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.panel__head > .text-button { display: none; }
.stack { gap: 20px; }
.selector-card { padding: 0 0 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.selector-card h3, .result-card h3 { color: #394a55; font-size: 15px; font-weight: 800; margin-bottom: 16px; }
.chip { border-radius: 5px; min-height: 44px; font-size: 14px; padding: 9px 12px; color: #354b59; border-color: #96a8b3; font-weight: 700; }
.chip.is-active { background: #e4f1eb; color: #084f43; border-color: #528c7b; }
.portal-player-picker { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.portal-select { width: 100%; min-width: 0; min-height: 48px; background: #fff; border: 1px solid #96a8b3; padding: 10px 12px; color: #1d3545; font-size: 16px; font-weight: 600; border-radius: 6px; }
.portal-search { position: relative; min-width: 0; display: flex; align-items: center; width: 100%; }
.portal-search > .portal-icon { position: absolute; left: 14px; color: #465e6d; width: 18px; height: 18px; }
.portal-search input { width: 100%; min-width: 0; min-height: 48px; border: 1px solid #96a8b3; border-radius: 6px; padding: 11px 12px 11px 42px; font-size: 16px; font-weight: 600; background: #fff; color: #1d3545; }
.portal-search input::placeholder { color: #526674; opacity: 1; font-size: 15px; font-weight: 500; }
.portal-search input:focus, .portal-select:focus { outline: 2px solid #a3cabd; outline-offset: 1px; }
.portal-toolbar { display: flex; align-items: center; gap: 16px; }
.portal-toolbar > .portal-search { flex: 1; }
.portal-count { color: var(--muted); font-size: 14px; font-weight: 700; white-space: nowrap; }
.portal-segments { display: flex; gap: 4px; padding: 4px; border-radius: 6px; background: #f0f3f5; }
.portal-segments button { flex: 1; min-height: 44px; padding: 6px 16px; border: 0; border-radius: 4px; color: #354b59; background: none; font-size: 14px; font-weight: 700; white-space: nowrap; }
.portal-segments button[aria-pressed=true] { color: var(--primary); background: #fff; }
.summary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.stat-card { border: 1px solid #b8c6d0; background: #fff; border-radius: 6px; padding: 16px; box-shadow: none; }
.stat-card__label { display: block; font-size: 14px; color: var(--muted); font-weight: 700; line-height: 1.5; padding-right: 16px; }
.stat-card__value { display: block; margin-top: 8px; font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-card--detail summary { position: relative; min-height: 60px; }
.stat-card--detail summary::after { content: "＋"; position: absolute; right: 0; top: 0; background: none; color: #8aa096; padding: 0; margin: 0; border-radius: 0; font-size: 16px; }
.stat-card--detail[open] summary::after { content: "−"; }
.stat-card__body { font-size: 14px; }
#guildUserDetails > .result-card { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 10px 0 20px; }
.calc-detail { border-radius: 0; border: 0; border-bottom: 1px solid var(--line); background: #fff; }
.calc-detail summary { padding: 14px 0; min-height: 48px; gap: 10px; }
.calc-detail summary::after { content: "＋"; background: none; padding: 0 4px; border-radius: 0; }
.calc-detail[open] summary::after { content: "−"; }
.calc-detail__label { font-size: 15px; font-weight: 700; }
.calc-detail__value { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.calc-detail__body { margin: 0 0 14px; padding: 14px; border-radius: 4px; background: #f1f4f6; font-size: 14px; }
.result-card__hint { color: var(--muted); font-size: 14px; }
.accordion { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: #fff; }
.accordion summary { min-height: 48px; padding: 16px 0; background: none; color: #40545f; font-weight: 750; font-size: 14px; display: flex; justify-content: space-between; gap: 14px; }
.accordion summary::after { content: "＋"; color: #8b9c9f; flex-shrink: 0; }
.accordion[open] summary::after { content: "−"; }
.accordion__body { padding: 0 0 18px; }
.detail-item { padding: 12px 0; gap: 16px; align-items: start; }
.detail-item__label { font-size: 14px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.detail-item__value { font-size: 14px; font-weight: 800; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.item-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
#adminResults .result-card { padding: 18px; border: 1px solid #e0e6e9; background: #fff; box-shadow: none; border-radius: 6px; }
.item-recipient { border-radius: 4px; background: #eaf1ee; color: #263e33; white-space: normal; min-width: 0; flex-wrap: wrap; overflow-wrap: anywhere; font-weight: 700; font-size: 14px; }
.item-recipient__pre-badge, .item-recipient__wish-badge, .item-recipient__proxy-badge { border-radius: 3px; font-size: 12px; font-weight: 700; }
.pre-distribution-notice { border-radius: 6px; box-shadow: none; }
.photo-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.photo-card { border: 1px solid #e1e7ea; background: #fff; border-radius: 6px; }
.portal-photo-open { display: block; padding: 0; border: 0; width: 100%; border-radius: 0; background: #f4f6f7; cursor: zoom-in; }
.portal-photo-open img { width: 100%; height: 260px; max-height: none; object-fit: contain; }
.photo-card__body { padding: 14px; }
.photo-card__title { font-size: 14px; font-weight: 700; color: #283e4d; overflow-wrap: anywhere; }
.photo-card__meta { font-size: 13px; font-weight: 500; color: var(--muted); line-height: 1.7; }
.value-layout { grid-template-columns: minmax(0,1.1fr) minmax(0,.9fr); gap: 32px; align-items: start; }
.info-table { color: #283e4d; font-size: 15px; font-weight: 500; }
.info-table th { background: #edf1f4; color: #354b59; font-size: 14px; font-weight: 700; }
.info-table td { border-bottom-color: #e7ecee; }
.info-table td:last-child { font-weight: 750; font-variant-numeric: tabular-nums; }
#itemsView .info-table th:first-child, #itemsView .info-table td:first-child { width: 52%; overflow-wrap: anywhere; }
#itemsView .info-table th:nth-child(2), #itemsView .info-table td:nth-child(2) { width: 20%; }
#itemsView .info-table th:nth-child(3), #itemsView .info-table td:nth-child(3) { width: 28%; }
.pill { border-radius: 4px; font-size: 12px; font-weight: 700; background: #eaf0f7; color: #365276; padding: 3px 7px; }
.pill--auto { background: #fbf1df; color: #79541c; }
.pill--positive { background: #e6f2e8; color: #286239; }
.pill--negative { background: #fcebe8; color: #963d30; }
.empty-state { border: 0; background: #f8fafb; box-shadow: none; padding: 28px 18px; border-radius: 5px; }
.empty-state__title { font-size: 16px; color: #354b59; }
.empty-state__desc { font-size: 14px; color: var(--muted); line-height: 1.7; }
/* Keep the strategy layouts and arithmetic intact while matching the shared controls. */
#riftView { background: #fff; padding: 24px; }
#riftView .selector-card { border-radius: 0; box-shadow: none; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 16px 0; }
.rift-module-card, .rift-analysis-choice, .rift-cycle-button { border-radius: 6px; box-shadow: none; background: #fff; border: 1px solid #dfe6ea; color: #405966; min-height: 90px; }
.rift-module-card::before { display: none; }
.rift-module-card:hover, .rift-module-card:focus-visible { transform: none; box-shadow: none; border-color: #82a99f; }
.rift-module-card__title { font-size: 18px; }
.rift-module-card__label { background: #eaf0f4; color: #354f60; border-radius: 4px; font-size: 13px; }
.rift-module-card__arrow { background: none; color: #859aa2; border-radius: 0; }
.rift-cycle-button strong { font-size: 15px; }
.rift-cycle-button span { color: var(--muted); font-size: 13px; }
.rift-module-toolbar { border-radius: 4px; background: #f6f8f9; box-shadow: none; }
#riftView:not(.rift-module-active) .panel__head h2 { font-size: 22px; }
.text-button { border-radius: 5px; font-size: 15px; font-weight: 700; min-height: 44px; }
.primary-action { border-radius: 5px; font-size: 14px; font-weight: 750; }
.input { border-radius: 5px; font-size: 16px; min-height: 44px; border-color: #dfe6ea; font-weight: 650; }
.rift-dialog__panel, .rift-gate__panel, .rift-idle-overlay__panel { border-radius: 8px; box-shadow: 0 12px 50px #1a333522; }
.rift-mobile-flow { top: 70px; }
.portal-bottom-nav { display: none; }
.portal-menu { width: min(480px,calc(100% - 32px)); padding: 0; border: 1px solid #dfe6ea; border-radius: 8px; color: var(--ink); max-height: calc(100dvh - 40px); }
.portal-menu::backdrop, .portal-photo-dialog::backdrop { background: #1d2e3b80; }
.portal-menu__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.portal-menu__head h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.portal-menu__list { display: grid; gap: 0; padding: 8px 20px 18px; }
.portal-menu__list button, .portal-menu__list a { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 0; background: #fff; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 16px; font-weight: 700; color: #283e4d; text-align: left; text-decoration: none; cursor: pointer; }
.portal-menu__list .portal-icon { color: #465e6d; }
.portal-menu__list .is-active { color: var(--primary); }
.portal-menu__list button:last-child { border-bottom: 0; }
.portal-photo-dialog { width: min(1100px,100%); max-width: 100%; height: 94dvh; max-height: 100dvh; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.portal-photo-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr); }
.portal-photo-dialog .portal-menu__head h2 { font-size: 14px; }
.portal-photo-actions { display: flex; gap: 8px; }
.portal-photo-canvas { overflow: auto; background: #edf1f3; padding: 14px; }
.portal-photo-canvas img { display: block; width: 100%; max-width: 100%; height: auto; margin: auto; }
.portal-photo-canvas.is-zoomed img { width: 200%; max-width: none; }
body:has(.portal-menu[open]), body:has(.portal-photo-dialog[open]) { overflow: hidden; }
.mode-card__desc, .rift-entry-card__desc, .portal-count, .stat-card__label,
.meta-chip span, .meta-chip label, .visual-card small, .photo-card__meta,
.panel__head p, .info-table th { color: var(--muted); }
@media(max-width:1190px) { .hero, .page { width: calc(100% - 48px); } }
@media(max-width:960px) { .portal-nav { display: none; } .hero { grid-template-columns: minmax(0,1fr) 210px; } .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .value-layout { grid-template-columns: minmax(0,1fr); } }
@media(max-width:680px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  html { scroll-padding-top: 76px; }
  .portal-header { padding: 0 18px; }
  .portal-header__inner { height: 62px; }
  .portal-brand { font-size: 16px; gap: 8px; }
  .portal-brand img { width: 28px; height: 28px; }
  .portal-icon-button { width: 42px; height: 42px; min-height: 42px; }
  .hero { width: 100%; padding: 24px 20px; grid-template-columns: minmax(0,1fr); gap: 20px; }
  .hero h1 { font-size: 23px; }
  .hero__meta { grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 12px; margin-top: 18px; }
  .meta-chip strong { font-size: 13px; }
  .meta-chip span, .meta-chip label { font-size: 12px; }
  .select-inline { font-size: 13px; padding: 10px 6px; min-height: 44px; }
  .hero__visual { grid-template-columns: repeat(2,minmax(0,1fr)); border-left: 0; border-top: 1px solid #e2e7e9; padding: 16px 0 0; }
  .visual-card { display: grid; grid-template-columns: 22px auto; align-items: center; gap: 0 10px; padding: 0; }
  .visual-card + .visual-card { padding-left: 22px; border-left: 1px solid #e0e7e9; }
  .visual-card .portal-icon { grid-row: 1 / 3; margin: 0; }
  .visual-card strong { font-size: 21px; line-height: 1.4; }
  .visual-card small { font-size: 12px; }
  .page { width: 100%; padding: 0; }
  .panel, .panel--home, #riftView { padding: 24px 20px; scroll-margin-top: 70px; }
  .panel--home .section-title { padding: 0 0 12px; }
  .panel--home .section-title h2 { font-size: 16px; }
  .mode-grid--primary { grid-template-columns: minmax(0,1fr); }
  .mode-card { min-height: 86px; gap: 14px; padding: 16px 0; }
  .mode-card__title, .rift-entry-card__title { font-size: 17px; }
  .mode-card__desc, .rift-entry-card__desc { font-size: 14px; }
  .rift-entry-card { min-height: 86px; padding: 16px 0 0; gap: 14px; }
  .panel__head { padding-bottom: 18px; margin-bottom: 20px; }
  .panel__head h2, #riftView .panel__head h2 { font-size: 20px; }
  .portal-player-picker { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .summary-grid { gap: 10px; }
  .stat-card { padding: 14px 12px; }
  .stat-card__value { font-size: 20px; }
  .item-grid { grid-template-columns: minmax(0,1fr); }
  #adminResults .result-card { padding: 16px; }
  .item-recipient { font-size: 14px; }
  .portal-toolbar--items { flex-direction: column; align-items: stretch; gap: 12px; }
  .portal-segments button { min-height: 44px; }
  #itemsView .selector-card { padding: 0 0 20px; }
  #itemsView .info-table th, #itemsView .info-table td { font-size: 14px; padding: 12px 6px; word-break: normal; }
  #itemsView .info-table td:last-child { font-size: 14px; overflow-wrap: anywhere; }
  #itemsView .pill { font-size: 12px; padding: 3px 5px; }
  .photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .portal-photo-open img { height: 190px; }
  .photo-card__body { padding: 10px; }
  .photo-card__meta { font-size: 13px; }
  .photo-card__title { font-size: 14px; }
  .calc-detail__value { font-size: 14px; overflow-wrap: anywhere; }
  .detail-item__value { font-size: 14px; max-width: 45%; white-space: normal; overflow-wrap: anywhere; text-align: right; }
  .detail-item__label { font-size: 14px; }
  .portal-bottom-nav { display: grid; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 0; background: #fff; border-top: 1px solid #e0e7eb; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .portal-bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 48px; padding: 0; border: 0; border-radius: 0; background: #fff; font-size: 12px; font-weight: 700; color: #465864; }
  .portal-bottom-nav .portal-icon { width: 20px; height: 20px; }
  .portal-bottom-nav button.is-active { color: var(--primary); }
  .rift-module-card__title { font-size: 17px; }
  #riftView:not(.rift-module-active) .panel__head h2 { font-size: 20px; }
  .rift-module-hub { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .rift-module-card { grid-template-columns: minmax(0,1fr) 26px; grid-template-rows: auto auto; gap: 10px; min-height: 90px; padding: 16px; }
  .rift-module-card__label { grid-column: 1; font-size: 13px; }
  .rift-module-card__title { grid-column: 1; max-width: none; line-height: 1.4; }
  .rift-module-card__arrow { grid-column: 2; grid-row: 1 / 3; align-self: center; box-shadow: none; }
  .rift-cycle-button { min-height: 72px; padding: 12px 16px; }
  .rift-module-toolbar { flex-wrap: wrap; }
  .rift-module-toolbar strong { font-size: 16px; line-height: 1.5; }
  .rift-layout { grid-template-columns: minmax(0,1fr); }
  .rift-mobile-flow { top: 62px; }
  .portal-menu { width: 100%; max-width: 100%; max-height: 88dvh; margin: auto 0 0; border: 0; border-radius: 8px 8px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .portal-menu__list { padding-bottom: 20px; }
  .portal-photo-dialog { position: fixed; inset: 0; width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .portal-photo-dialog .portal-menu__head { padding: max(10px,env(safe-area-inset-top)) 12px 10px; }
  .portal-photo-canvas { padding-bottom: max(14px,env(safe-area-inset-bottom)); }
}
@media(max-width:360px) { .panel, .panel--home, #riftView { padding-left: 16px; padding-right: 16px; } .hero { padding-left: 16px; padding-right: 16px; } .portal-header { padding: 0 16px; } .hero__meta { grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); } .photo-grid { grid-template-columns: minmax(0,1fr); } }
@media(prefers-reduced-motion:reduce) { button { transition: none; } html { scroll-behavior: auto; } }

/* Date and battle selection load the original photos on demand. */
.photo-timeline { display: grid; gap: 10px; }
.photo-timeline-note { margin: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.photo-day { min-width: 0; border: 1px solid #dce5e9; border-radius: 10px; background: #fff; }
.photo-day > summary, .photo-event > summary { list-style: none; cursor: pointer; min-height: 48px; }
.photo-day > summary::-webkit-details-marker, .photo-event > summary::-webkit-details-marker { display: none; }
.photo-day > summary { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.photo-day > summary::before { content: "›"; color: #527485; font-size: 23px; line-height: 1; }
.photo-day[open] > summary::before { transform: rotate(90deg); }
.photo-day > summary span { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.photo-event { min-width: 0; border-top: 1px solid #e7edf0; }
.photo-event > summary { display: grid; grid-template-columns: minmax(9.1em, max-content) minmax(0, 1fr) max-content; align-items: center; gap: 10px; padding: 10px 14px; font-size: 14px; }
.photo-event > summary time { font-variant-numeric: tabular-nums; color: #536a76; }
.photo-event > summary strong { overflow-wrap: anywhere; }
.photo-event__action { color: #176157; white-space: nowrap; font-weight: 700; }
.photo-event[open] > summary { background: #eff6f4; }
.photo-event > .photo-grid { padding: 12px 14px 14px; }
.photo-day > summary:focus-visible, .photo-event > summary:focus-visible { outline: 2px solid #2b786b; outline-offset: -2px; }
@media (max-width: 520px) {
  .photo-event > summary { grid-template-columns: minmax(0, 1fr) max-content; gap: 4px 10px; }
  .photo-event > summary time { grid-column: 1; font-size: 12px; }
  .photo-event > summary strong { grid-column: 1; grid-row: 2; }
  .photo-event__action { grid-column: 2; grid-row: 1 / span 2; }
}
