/* Keep semantic hidden elements out of the layout even when a component
   class defines display:grid/flex later in this stylesheet. */
[hidden] { display: none !important; }

:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: rgba(255,255,255,.9);
  --surface-solid: #ffffff;
  --surface-alt: #edf4ff;
  --text: #122033;
  --muted: #64748b;
  --line: #dce6f2;
  --primary: #1367f2;
  --primary-strong: #0f4fc2;
  --primary-soft: #e7f0ff;
  --success: #15945d;
  --success-soft: #e6f7ef;
  --warning: #b56b00;
  --danger: #d33a4b;
  --shadow: 0 18px 45px rgba(34, 71, 123, .12);
  --shadow-soft: 0 8px 24px rgba(34, 71, 123, .08);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --max: 1240px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07101d;
  --surface: rgba(14, 26, 44, .88);
  --surface-solid: #0e1a2c;
  --surface-alt: #13243b;
  --text: #edf5ff;
  --muted: #9eb0c7;
  --line: #243853;
  --primary: #5aa2ff;
  --primary-strong: #3388f5;
  --primary-soft: #122b4b;
  --success: #4fd59a;
  --success-soft: #12372b;
  --warning: #ffc46b;
  --danger: #ff7d8a;
  --shadow: 0 22px 55px rgba(0,0,0,.32);
  --shadow-soft: 0 8px 24px rgba(0,0,0,.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(64, 145, 255, .12), transparent 30%),
    radial-gradient(circle at 90% 20%, rgba(22, 194, 146, .08), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell { min-height: 100vh; padding-bottom: 104px; }
.topbar {
  width: min(calc(100% - 32px), var(--max));
  margin: 18px auto 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px 12px 16px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 12px;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; border: 0; background: transparent; cursor: pointer; padding: 0; text-align: left; }
.brand img { width: 44px; height: 44px; border-radius: 13px; box-shadow: 0 6px 18px rgba(21, 103, 242, .2); }
.brand span { display: grid; line-height: 1.1; }
.brand strong { font-size: 1.02rem; letter-spacing: -.02em; }
.brand small { color: var(--muted); margin-top: 4px; font-size: .72rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .78rem; background: var(--surface-solid); }
.status-dot { width: 8px; height: 8px; border-radius: 999px; background: #9aa8b9; box-shadow: 0 0 0 4px color-mix(in srgb, #9aa8b9 18%, transparent); }
.status-badge.online .status-dot { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 18%, transparent); }
.status-badge.offline .status-dot { background: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 18%, transparent); }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-solid); display: grid; place-items: center; cursor: pointer; }

main { width: min(calc(100% - 32px), var(--max)); margin: 34px auto 0; }
.view { display: none; animation: viewIn .32s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: clamp(32px, 6vw, 88px);
  min-height: 530px;
  padding: clamp(34px, 5vw, 74px);
  border-radius: 36px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-solid) 94%, transparent), color-mix(in srgb, var(--primary-soft) 68%, var(--surface-solid))),
    var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero::before { content: ""; position: absolute; inset: -35% auto auto 55%; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(63,145,255,.18), transparent 66%); }
.hero-copy { position: relative; z-index: 2; }
.eyebrow { display: inline-block; color: var(--primary); font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(2.3rem, 5vw, 4.65rem); line-height: 1.02; letter-spacing: -.055em; }
h2 { margin-bottom: 9px; font-size: 1.2rem; letter-spacing: -.025em; }
.hero p { max-width: 680px; color: var(--muted); font-size: 1.06rem; }
.hero-actions, .button-row, .button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.button.primary { color: white; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); box-shadow: 0 11px 25px rgba(19,103,242,.24); }
.button.secondary { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 34%, var(--line)); background: var(--primary-soft); }
.button.ghost { border-color: var(--line); background: var(--surface-solid); }
.button.success { color: white; background: linear-gradient(135deg, #16a268, #0f7f52); }
.button.kofi { color: #fff; background: #ff5f5f; }
.button.compact { min-height: 40px; padding: 0 13px; border-radius: 12px; font-size: .84rem; }
.button.full { width: 100%; }
.text-button { border: 0; background: transparent; color: var(--primary); padding: 4px 0; font-weight: 750; cursor: pointer; }

.hero-visual { min-height: 360px; display: grid; place-items: center; position: relative; z-index: 2; }
.device { position: absolute; border: 7px solid #0a1525; background: #0a1525; box-shadow: 0 32px 45px rgba(15,45,88,.25); }
.device-screen { width: 100%; height: 100%; overflow: hidden; background: linear-gradient(145deg, #edf6ff, #cadfff); display: grid; place-items: center; }
.desktop-device { width: min(92%, 430px); height: 255px; border-radius: 22px; transform: translate(-6%, -7%) rotate(-3deg); }
.desktop-device::after { content: ""; position: absolute; left: 38%; right: 38%; height: 38px; bottom: -39px; background: #0a1525; clip-path: polygon(25% 0,75% 0,100% 100%,0 100%); }
.desktop-device::before { content: ""; position: absolute; width: 50%; height: 9px; bottom: -46px; left: 25%; border-radius: 999px; background: #0a1525; }
.phone-device { width: 122px; height: 242px; border-radius: 28px; transform: translate(130%, 35%) rotate(6deg); border-width: 6px; }
.phone-device .device-screen img { width: 76px; border-radius: 22px; }
.device-camera { position: absolute; z-index: 3; top: 6px; left: 50%; transform: translateX(-50%); width: 34px; height: 5px; border-radius: 99px; background: #223147; }
.mini-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: #17335a; }
.mini-brand img { width: 42px; border-radius: 12px; }
.mini-progress { position: absolute; width: 56%; height: 8px; border-radius: 99px; background: rgba(20,82,160,.15); transform: translateY(58px); overflow: hidden; }
.mini-progress span { display: block; width: 72%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#1367f2,#45b4ff); animation: miniProgress 2.6s ease-in-out infinite alternate; }
@keyframes miniProgress { from { width: 20%; } to { width: 88%; } }
.transfer-orbit { position: absolute; inset: 12% 4% 2% 10%; border: 1px dashed rgba(19,103,242,.34); border-radius: 50%; animation: spin 14s linear infinite; }
.transfer-orbit span { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 8px rgba(19,103,242,.12); }
.transfer-orbit span:nth-child(1) { top: 8%; left: 23%; }
.transfer-orbit span:nth-child(2) { right: 2%; top: 48%; }
.transfer-orbit span:nth-child(3) { bottom: 6%; left: 32%; }
@keyframes spin { to { transform: rotate(360deg); } }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 22px; }
.feature-card { display: flex; gap: 15px; padding: 23px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-soft); }
.feature-card p { margin-bottom: 0; color: var(--muted); font-size: .9rem; }
.feature-icon { flex: 0 0 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: var(--primary); background: var(--primary-soft); }
.quick-panel { margin-top: 22px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.quick-panel p { margin: 0; color: var(--muted); }

.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); padding: 26px; backdrop-filter: blur(16px); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 12px 0 24px; }
.section-heading h1 { font-size: clamp(2.2rem, 4vw, 3.8rem); margin: 4px 0 10px; }
.section-heading p { color: var(--muted); margin: 0; }
.mode-switch { display: inline-flex; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); margin-bottom: 20px; }
.mode-button { min-width: 130px; min-height: 46px; border: 0; border-radius: 12px; background: transparent; display: flex; gap: 8px; align-items: center; justify-content: center; font-weight: 750; color: var(--muted); cursor: pointer; }
.mode-button.active { color: var(--primary); background: var(--primary-soft); }
.transfer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.transfer-panel { display: none; }
.transfer-panel.active { display: block; }
.transfer-sidebar { display: grid; gap: 16px; position: sticky; top: 104px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.panel-heading > div:first-child { display: flex; align-items: center; gap: 13px; }
.panel-heading h2, .panel-heading p { margin: 0; }
.panel-heading p { color: var(--muted); font-size: .86rem; margin-top: 2px; }
.compact-heading { margin-top: 22px; }
.step-number { flex: 0 0 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--primary-soft); color: var(--primary); font-weight: 850; }
.done-step { background: var(--success-soft); color: var(--success); }
.pill { padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: .76rem; background: var(--surface-solid); }
.connection-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .76rem; font-weight: 750; }
.connection-state span { width: 8px; height: 8px; border-radius: 50%; background: #9aa8b9; }
.connection-state.connecting span { background: var(--warning); animation: pulse 1.2s infinite; }
.connection-state.connected { color: var(--success); }
.connection-state.connected span { background: var(--success); }
.connection-state.failed { color: var(--danger); }
.connection-state.failed span { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }
.drop-zone { min-height: 190px; border: 1.5px dashed color-mix(in srgb, var(--primary) 44%, var(--line)); border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 7px; padding: 24px; color: var(--muted); cursor: pointer; background: color-mix(in srgb, var(--primary-soft) 40%, transparent); transition: border-color .18s, background .18s, transform .18s; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.drop-zone strong { color: var(--text); }
.drop-zone small { max-width: 500px; }
.drop-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; color: var(--primary); background: var(--surface-solid); box-shadow: var(--shadow-soft); margin-bottom: 4px; }
.file-list { display: grid; gap: 10px; margin-top: 14px; }
.file-list.empty-state { min-height: 54px; place-items: center; color: var(--muted); border-radius: 14px; background: color-mix(in srgb, var(--surface-alt) 58%, transparent); font-size: .88rem; padding: 14px; }
.file-item { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-solid); }
.file-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--primary); background: var(--primary-soft); }
.file-info { min-width: 0; }
.file-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info small { color: var(--muted); }
.file-action { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px; }
.file-progress { grid-column: 2 / -1; height: 6px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.file-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--primary), #4cb4ff); }
.divider { height: 1px; background: var(--line); margin: 25px 0; }
.field-group { display: grid; gap: 8px; margin-top: 15px; }
.field-group label { font-size: .82rem; font-weight: 750; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
textarea { width: 100%; min-height: 110px; resize: vertical; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-solid); color: var(--text); outline: none; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .76rem; line-height: 1.45; }
textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.storage-card { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-solid); padding: 14px; }
.storage-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; color: var(--primary); background: var(--primary-soft); }
.storage-card p { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }
.status-panel h2 { margin: 7px 0; }
.status-panel p { color: var(--muted); font-size: .9rem; }
.progress-track { height: 9px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; margin-top: 20px; }
.progress-track span { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #4cb4ff); transition: width .2s ease; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; margin-top: 8px; }
.notice-panel { display: flex; gap: 13px; background: color-mix(in srgb, var(--primary-soft) 50%, var(--surface)); }
.notice-panel > svg { flex: 0 0 22px; color: var(--primary); }
.notice-panel p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.notice-panel code { color: var(--text); }
.tips-panel ul, .privacy-card ul { padding-left: 18px; margin-bottom: 0; color: var(--muted); }
.tips-panel li + li, .privacy-card li + li { margin-top: 8px; }
.received-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.downloads-heading {
  width: min(100%, 900px);
  max-width: 900px;
  margin: 0 auto 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.downloads-heading > div {
  width: 100%;
  margin-inline: auto;
  text-align: center;
}
.downloads-heading .eyebrow,
.downloads-heading h1,
.downloads-heading p {
  text-align: center;
}
.downloads-heading h1 { margin-bottom: 12px; }
.downloads-heading p { color: var(--muted); font-size: 1rem; }
.download-grid {
  width: min(100%, 1080px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: stretch;
}
.download-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 438px;
  padding: 28px 24px 24px;
  overflow: hidden;
  text-align: center;
  transition: transform .24s ease, border-color .24s ease, box-shadow .24s ease;
}
.download-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -95px;
  left: 50%;
  width: 260px;
  height: 220px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 20%, transparent), transparent 70%);
  opacity: .8;
  pointer-events: none;
}
.download-card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--primary) 46%, var(--line));
  box-shadow: 0 26px 58px color-mix(in srgb, var(--primary) 14%, transparent);
}
.download-card-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
}
.download-card .platform-icon {
  width: 126px;
  height: 126px;
  display: grid;
  place-items: center;
  margin: 0 auto 21px;
  border-radius: 32px;
  background: transparent;
  filter: drop-shadow(0 15px 25px rgba(26, 80, 180, .28));
  transition: transform .24s ease, filter .24s ease;
}
.download-card:hover .platform-icon {
  transform: translateY(-2px) scale(1.035);
  filter: drop-shadow(0 18px 34px rgba(45, 115, 255, .38));
}
.download-card .platform-icon img {
  width: 112px;
  height: 112px;
  display: block;
}
.download-card h2 {
  margin: 5px 0 10px;
  font-size: 1.34rem;
}
.download-card p { color: var(--muted); }
.download-card .version-line {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 650;
}
.download-description {
  max-width: 295px;
  min-height: 76px;
  margin: 0 auto;
  font-size: .94rem;
}
.download-button { margin-top: 24px; }
.download-card.disabled { opacity: .9; }
.download-card.disabled:hover { transform: none; }

.about-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; align-items: start; }
.about-card { grid-row: span 2; padding: clamp(28px, 4vw, 48px); }
.about-logo { width: 98px; height: 98px; border-radius: 28px; box-shadow: 0 18px 36px rgba(19,103,242,.18); margin-bottom: 22px; }
.about-card h1 { font-size: clamp(2.5rem, 5vw, 4.2rem); margin: 4px 0 10px; }
.lead { color: var(--muted); font-size: 1.05rem; }
.metadata-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin: 28px 0; }
.metadata-grid div { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-solid); }
.metadata-grid span { display: block; color: var(--muted); font-size: .74rem; margin-bottom: 4px; }
.metadata-grid strong { font-size: .9rem; }
.signature { font-family: "Segoe Script", "Bradley Hand", cursive; font-size: clamp(2rem, 5vw, 3.5rem); color: var(--primary); transform: rotate(-3deg); margin: 14px 0 20px; }
.signature span { font-size: .58em; color: var(--muted); }
.support-card p, .privacy-card p { color: var(--muted); }
.gcash-block { display: grid; grid-template-columns: 116px minmax(0,1fr); gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: 17px; padding: 14px; margin-top: 14px; background: var(--surface-solid); }
.gcash-block img { width: 116px; height: 116px; object-fit: cover; border-radius: 12px; }
.gcash-block p { margin: 4px 0; font-size: .84rem; }
.gcash-block small { color: var(--muted); }
.fine-print { margin: 14px 0 0; font-size: .76rem; }

.bottom-nav { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); width: min(calc(100% - 28px), 580px); display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; padding: 7px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(22px); }
.bottom-nav button { min-height: 58px; border: 0; border-radius: 15px; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 3px; font-size: .7rem; font-weight: 750; cursor: pointer; }
.bottom-nav button svg { font-size: 1.25rem; }
.bottom-nav button.active { color: var(--primary); background: var(--primary-soft); }

.toast-region { position: fixed; z-index: 100; top: 100px; right: 18px; display: grid; gap: 10px; width: min(360px, calc(100% - 36px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-solid); box-shadow: var(--shadow); animation: toastIn .25s ease; }
.toast.success { border-color: color-mix(in srgb, var(--success) 45%, var(--line)); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.toast strong { display: block; font-size: .86rem; }
.toast p { margin: 2px 0 0; color: var(--muted); font-size: .78rem; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }

/* Keep the download edition selector visually centered between the header and fixed navigation. */
@media (min-width: 981px) and (min-height: 720px) {
  .downloads-view.active {
    min-height: calc(100dvh - 214px);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-visual { min-height: 330px; }
  .feature-grid { grid-template-columns: 1fr; }
  .download-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .transfer-layout { grid-template-columns: 1fr; }
  .transfer-sidebar { position: static; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .status-panel { grid-column: 1 / -1; }
  .about-layout { grid-template-columns: 1fr; }
  .about-card { grid-row: auto; }
}

@media (max-width: 680px) {
  .app-shell { padding-bottom: 98px; }
  .topbar { width: calc(100% - 20px); margin-top: 10px; top: 8px; border-radius: 18px; }
  .status-badge { display: none; }
  .brand small { display: none; }
  main { width: calc(100% - 20px); margin-top: 18px; }
  .hero { padding: 28px 22px; border-radius: 26px; }
  .hero h1 { font-size: clamp(2.15rem, 12vw, 3.25rem); }
  .hero-visual { min-height: 270px; transform: scale(.92); }
  .desktop-device { width: 94%; height: 205px; }
  .phone-device { transform: translate(108%, 39%) rotate(6deg); }
  .feature-grid { gap: 12px; }
  .quick-panel, .section-heading { align-items: flex-start; flex-direction: column; }
  .panel { padding: 19px; border-radius: 22px; }
  .mode-switch { width: 100%; }
  .mode-button { flex: 1; min-width: 0; }
  .panel-heading { align-items: flex-start; }
  .panel-heading > .pill, .panel-heading > .connection-state { margin-top: 6px; }
  .storage-card { grid-template-columns: 42px 1fr; }
  .storage-card .button { grid-column: 1 / -1; width: 100%; }
  .transfer-sidebar { grid-template-columns: 1fr; }
  .status-panel { grid-column: auto; }
  .metadata-grid { grid-template-columns: 1fr; }
  .gcash-block { grid-template-columns: 1fr; }
  .gcash-block img { width: min(100%, 220px); height: auto; justify-self: center; }
  .bottom-nav { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 16px); border-radius: 19px; }
  .bottom-nav button { min-height: 54px; }
  .toast-region { top: 82px; right: 10px; width: calc(100% - 20px); }
}

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

@media (max-width: 700px) {
  .download-grid { grid-template-columns: 1fr; max-width: 430px; }
  .download-card { min-height: 410px; padding: 25px 20px 21px; }
  .download-card .platform-icon { width: 118px; height: 118px; }
  .download-card .platform-icon img { width: 106px; height: 106px; }
  .download-description { min-height: 0; }
}

/* SwiftShare Web 1.5.3 smart transfer workspace */
.button.danger { color: #fff; background: linear-gradient(135deg, #df4354, #b91f35); }
.large-action { min-height: 56px; margin-top: 20px; font-size: .98rem; }
.transfer-view { padding-bottom: 28px; }
.transfer-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin: 8px auto 24px;
}
.transfer-heading > div:first-child { max-width: 760px; }
.transfer-heading h1 { margin: 4px 0 10px; font-size: clamp(2.3rem, 5vw, 4.4rem); }
.transfer-heading p { margin: 0; color: var(--muted); font-size: 1rem; }
.transfer-heading-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.network-readiness {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}
.network-readiness span { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 15%, transparent); }
.network-readiness.offline span { background: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 15%, transparent); }

.role-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.role-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 116px;
  padding: 20px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.role-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 42%, var(--line)); }
.role-card.active { border-color: color-mix(in srgb, var(--primary) 58%, var(--line)); box-shadow: 0 16px 38px color-mix(in srgb, var(--primary) 13%, transparent); background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface)); }
.role-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: #fff; }
.role-icon.send { background: linear-gradient(145deg, #176df5, #4caaff); }
.role-icon.receive { background: linear-gradient(145deg, #13a772, #48d39e); }
.role-icon svg { width: 26px; height: 26px; }
.role-card strong { display: block; font-size: 1.12rem; }
.role-card small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.45; }
.role-arrow { color: var(--primary); font-size: 1.4rem; font-weight: 800; }

.smart-transfer-layout { grid-template-columns: minmax(0, 1fr) 370px; gap: 20px; }
.transfer-panel { padding: clamp(22px, 3vw, 32px); }
.workspace-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.workspace-title > div:first-child { display: flex; align-items: center; gap: 13px; }
.workspace-title h2, .workspace-title p { margin: 0; }
.workspace-title p { color: var(--muted); margin-top: 2px; font-size: .86rem; }
.section-gap { margin-top: 30px; }
.picker-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 10px; }
.drop-zone { min-height: 220px; }
.drop-zone .button { pointer-events: auto; }
.selected-file-item { grid-template-columns: 46px minmax(0,1fr) auto; }
.file-thumbnail { width: 46px; height: 46px; object-fit: cover; border-radius: 13px; background: var(--surface-alt); }
.kind-image { color: #7c4dff; }
.kind-video { color: #e05667; }
.kind-audio { color: #d88400; }
.kind-app { color: #16a268; }

.pair-method-switch { display: inline-flex; gap: 5px; padding: 5px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-alt); }
.pair-method { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.pair-method.active { color: var(--primary); background: var(--surface-solid); box-shadow: var(--shadow-soft); }
.pair-method-panel { display: none; }
.pair-method-panel.active { display: block; animation: viewIn .22s ease; }
.inline-notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin-bottom: 14px; border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line)); border-radius: 15px; background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface-solid)); }
.inline-notice svg { flex: 0 0 20px; color: var(--primary); margin-top: 2px; }
.inline-notice p { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }
.room-card { display: grid; grid-template-columns: minmax(190px, 230px) minmax(0, 1fr); align-items: center; gap: 24px; margin-top: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-solid); }
.qr-code { width: min(100%, 230px); aspect-ratio: 1; padding: 10px; border: 1px solid #d8e1eb; border-radius: 18px; background: #fff; box-shadow: var(--shadow-soft); }
.qr-code svg { display: block; width: 100%; height: 100%; shape-rendering: crispEdges; stroke: none !important; stroke-width: 0 !important; stroke-linecap: butt !important; stroke-linejoin: miter !important; }
.qr-code svg path, .qr-code svg rect { stroke: none !important; stroke-width: 0 !important; }
.qr-code svg path { fill: #000 !important; }
.qr-code svg rect { fill: #fff !important; }
.room-details { min-width: 0; }
.room-code { display: block; margin: 7px 0; color: var(--text); font-size: clamp(2rem, 7vw, 3.8rem); letter-spacing: .09em; line-height: 1; }
.room-details p { color: var(--muted); }
.room-input-label { display: block; margin-bottom: 8px; font-size: .82rem; font-weight: 750; }
.room-input-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; margin-bottom: 12px; }
.room-input { width: 100%; min-height: 58px; border: 1px solid var(--line); border-radius: 15px; padding: 0 18px; background: var(--surface-solid); color: var(--text); outline: none; font-size: 1.75rem; letter-spacing: .22em; font-weight: 850; text-align: center; }
.room-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.peer-card { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 18px; padding: 14px; border: 1px solid color-mix(in srgb, var(--success) 34%, var(--line)); border-radius: 17px; background: color-mix(in srgb, var(--success-soft) 55%, var(--surface-solid)); }
.peer-avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: var(--primary); background: var(--surface-solid); }
.peer-card small, .peer-card strong { display: block; }
.peer-card small { color: var(--muted); font-size: .73rem; }
.verified-badge { display: inline-flex; align-items: center; gap: 5px; color: var(--success); font-size: .76rem; font-weight: 800; }

.live-card-head, .history-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.transfer-controls { display: flex; gap: 8px; margin-top: 16px; }
.transfer-controls .button { flex: 1; }
.history-panel h2 { margin: 3px 0 0; }
.history-list { display: grid; gap: 9px; margin-top: 16px; }
.history-list.empty-state { min-height: 90px; place-items: center; display: grid; color: var(--muted); text-align: center; font-size: .84rem; }
.history-item { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-solid); }
.history-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; }
.history-icon.sent { color: var(--primary); background: var(--primary-soft); }
.history-icon.received { color: var(--success); background: var(--success-soft); }
.history-item strong, .history-item small { display: block; }
.history-item strong { font-size: .81rem; }
.history-item small { color: var(--muted); font-size: .69rem; margin-top: 2px; }
.history-status { font-size: .69rem; font-weight: 800; }
.history-status.success { color: var(--success); }
.history-status.failed { color: var(--danger); }

.app-dialog { width: min(calc(100% - 28px), 560px); max-height: calc(100dvh - 40px); padding: 0; border: 0; border-radius: 26px; background: transparent; color: var(--text); overflow: visible; }
.app-dialog::backdrop { background: rgba(4, 12, 24, .68); backdrop-filter: blur(7px); }
.dialog-card { max-height: calc(100dvh - 40px); overflow: auto; padding: clamp(24px, 5vw, 36px); border: 1px solid var(--line); border-radius: 26px; background: var(--surface-solid); box-shadow: 0 32px 80px rgba(0,0,0,.28); }
.dialog-card h2 { margin: 8px 0 10px; font-size: clamp(1.55rem, 4vw, 2rem); }
.dialog-card > p { color: var(--muted); }
.dialog-icon { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 18px; color: var(--primary); background: var(--primary-soft); }
.dialog-icon.success { color: var(--success); background: var(--success-soft); }
.dialog-icon.warning { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, var(--surface-solid)); }
.dialog-icon svg { width: 27px; height: 27px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.approval-details, .completion-stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 20px; }
.approval-details div, .completion-stats div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-alt); }
.approval-details span, .completion-stats span { display: block; color: var(--muted); font-size: .71rem; margin-bottom: 3px; }
.approval-details strong, .completion-stats strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.help-steps { padding-left: 22px; color: var(--muted); }
.help-steps li + li { margin-top: 8px; }
.scanner-dialog { width: min(calc(100% - 28px), 620px); }
.scanner-frame { position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 20px; background: #06101c; }
.scanner-frame video { width: 100%; height: 100%; object-fit: cover; }
.scanner-target { position: absolute; inset: 14%; border: 3px solid rgba(255,255,255,.92); border-radius: 20px; box-shadow: 0 0 0 999px rgba(0,0,0,.3); }

@media (max-width: 980px) {
  .smart-transfer-layout { grid-template-columns: 1fr; }
  .smart-transfer-layout .transfer-sidebar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .smart-transfer-layout .live-card, .smart-transfer-layout .history-panel { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .transfer-heading { align-items: flex-start; flex-direction: column; }
  .transfer-heading-actions { justify-content: flex-start; }
  .role-card-grid { grid-template-columns: 1fr; }
  .role-card { min-height: 100px; }
  .room-card { grid-template-columns: 1fr; text-align: center; }
  .qr-code { margin: 0 auto; }
  .room-details .button-row { justify-content: center; }
}

@media (max-width: 680px) {
  .transfer-heading h1 { font-size: clamp(2.15rem, 12vw, 3.2rem); }
  .transfer-heading-actions { width: 100%; }
  .network-readiness { width: 100%; justify-content: center; }
  .role-card { grid-template-columns: 52px minmax(0,1fr); padding: 16px; }
  .role-arrow { display: none; }
  .role-icon { width: 52px; height: 52px; }
  .workspace-title { align-items: flex-start; flex-direction: column; }
  .workspace-title > div:first-child { align-items: flex-start; }
  .pair-method-switch { width: 100%; }
  .pair-method { flex: 1; min-width: 0; }
  .room-input-row { grid-template-columns: 1fr; }
  .room-input-row .button { width: 100%; }
  .peer-card { grid-template-columns: 44px minmax(0,1fr); }
  .peer-card .verified-badge { grid-column: 1 / -1; justify-self: start; }
  .smart-transfer-layout .transfer-sidebar { grid-template-columns: 1fr; }
  .smart-transfer-layout .live-card, .smart-transfer-layout .history-panel { grid-column: auto; }
  .approval-details, .completion-stats { grid-template-columns: 1fr; }
  .dialog-actions .button { flex: 1; }
}
