:root {
  --bg: #f3f1ec;          /* the warm paper behind the card */
  --card: #ffffff;
  --ink: #17181b;         /* text and the Apps bricks */
  --muted: #8b8c91;
  --line: rgba(23, 24, 27, 0.08);
  --accent: #2f62ff;      /* the one accent: Photos and the button */
  --messages: #a9abb2;
  --cache: #e4e1da;
  --cache-line: rgba(23, 24, 27, 0.16);
  --radius: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background:
    radial-gradient(120% 80% at 50% 0%, #f8f7f3 0%, var(--bg) 60%, #ebe8e1 100%);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: min(16px, 3vh) 12px;
}

.card {
  width: min(340px, 100%);
  background: var(--card);
  border-radius: var(--radius);
  padding: clamp(12px, 3.6vh, 20px) clamp(14px, 4.4vw, 20px);
  box-shadow:
    0 0 0 1px rgba(23, 24, 27, 0.05),
    0 1px 1px rgba(23, 24, 27, 0.04),
    0 6px 14px -6px rgba(23, 24, 27, 0.10),
    0 28px 60px -24px rgba(23, 24, 27, 0.22);
  position: relative;
}
.card::before {
  /* the 1px light along the top edge */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 30%);
  mix-blend-mode: overlay;
}

.head { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 7px; }
.brand__mark { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.brand__name { font-size: 13px; font-weight: 640; letter-spacing: -0.01em; }
.device { font-size: 11.5px; color: var(--muted); font-weight: 480; }

.title { margin-top: clamp(8px, 2.4vh, 14px); display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.title__h { font-size: clamp(19px, 5.4vh, 23px); font-weight: 680; letter-spacing: -0.025em; font-variation-settings: 'wdth' 92; }
.title__used { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.title__used b { color: var(--ink); font-weight: 620; }

.cap {
  margin-top: clamp(7px, 2vh, 11px);
  height: 5px;
  border-radius: 3px;
  background: #efede8;
  display: flex;
  gap: 2px;
  overflow: hidden;
}
.cap i { display: block; height: 100%; border-radius: 3px; }
.cap [data-seg="photos"] { background: var(--accent); }
.cap [data-seg="apps"] { background: var(--ink); }
.cap [data-seg="messages"] { background: var(--messages); }
.cap [data-seg="cache"] { background: repeating-linear-gradient(-45deg, var(--cache) 0 2px, #cfcbc2 2px 3.5px); }

/* the glass tray */
.tray {
  margin-top: clamp(9px, 2.6vh, 14px);
  height: clamp(104px, 31vh, 172px);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #f6f5f2 0%, #f1efea 100%);
  box-shadow:
    inset 0 1px 2px rgba(23, 24, 27, 0.08),
    inset 0 0 0 1px rgba(23, 24, 27, 0.06);
}
.tray__glass {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 calc(25% - 1px), rgba(23, 24, 27, 0.045) calc(25% - 1px) 25%);
  pointer-events: none;
}
.tray__lip {
  /* the glass over the bricks: a sheen at the top and a soft reflection down one side */
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0, rgba(255, 255, 255, 0) 14px),
    linear-gradient(100deg, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, 0.22) 70%, rgba(255, 255, 255, 0) 78%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.7);
}
.tray__bricks { position: absolute; inset: 0; }
.tray__sweep {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 40%;
  background: linear-gradient(90deg, rgba(47, 98, 255, 0), rgba(47, 98, 255, 0.10) 45%, rgba(255, 255, 255, 0.55) 50%, rgba(47, 98, 255, 0.10) 55%, rgba(47, 98, 255, 0));
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.brick {
  position: absolute; left: 0; top: 0;
  will-change: transform;
}
.brick__body {
  position: absolute; inset: 1.5px;
  border-radius: 4px;
  transform-origin: 50% 100%;
  box-shadow: 0 1px 1px rgba(23, 24, 27, 0.12), 0 2px 5px -2px rgba(23, 24, 27, 0.18);
}
.brick__body::after {
  /* the bevel: light on top, a hair of shade under */
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), inset 0 -1px 0 rgba(0, 0, 0, 0.10);
}
.brick--photos .brick__body { background: linear-gradient(180deg, #4a78ff, var(--accent) 70%, #2754e6); }
.brick--apps .brick__body { background: linear-gradient(180deg, #34363b, var(--ink) 70%); }
.brick--messages .brick__body { background: linear-gradient(180deg, #bcbec4, var(--messages)); }
.brick--cache .brick__body {
  background: repeating-linear-gradient(-45deg, var(--cache) 0 3px, #d6d2c9 3px 5px);
  box-shadow: inset 0 0 0 1px var(--cache-line), 0 1px 2px rgba(23, 24, 27, 0.06);
}
.brick--cache .brick__body::after { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6); }


/* legend */
.legend {
  list-style: none;
  margin-top: clamp(8px, 2.4vh, 14px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(4px, 1.2vh, 8px) 10px;
}
.leg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  row-gap: 5px;
  padding: clamp(5px, 1.4vh, 8px) 9px clamp(6px, 1.6vh, 9px);
  border-radius: 10px;
  cursor: default;
}
.leg__name { font-size: 12.5px; font-weight: 560; letter-spacing: -0.005em; }
.leg__gb { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.leg__gb b { font-weight: 560; color: var(--ink); }
.leg__bar { grid-column: 1 / -1; height: 2px; border-radius: 2px; background: #efede8; overflow: hidden; }
.leg__bar i { display: block; height: 100%; width: 0; border-radius: 2px; transform-origin: left center; }
.leg[data-cat="photos"] .leg__bar i { background: var(--accent); }
.leg[data-cat="apps"] .leg__bar i { background: var(--ink); }
.leg[data-cat="messages"] .leg__bar i { background: var(--messages); }
.leg[data-cat="cache"] .leg__bar i { background: repeating-linear-gradient(-45deg, #d2cec5 0 2px, #b9b4aa 2px 3.5px); }
.leg.is-on { background: #f5f4f0; }

/* footer */
.foot {
  margin-top: clamp(8px, 2.4vh, 14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.foot__note { font-size: 11.5px; color: var(--muted); line-height: 1.3; max-width: 13em; }

.btn {
  position: relative;
  height: 38px;
  padding: 0 16px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
  flex: none;
  -webkit-tap-highlight-color: transparent;
}
.btn__bg {
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #4a76ff, var(--accent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(31, 66, 190, 0.35),
    0 8px 18px -8px rgba(47, 98, 255, 0.65);
}
.btn__label { position: relative; display: flex; height: 100%; align-items: center; justify-content: center; }
.btn__a, .btn__b { display: flex; align-items: center; gap: 6px; justify-content: center; white-space: nowrap; }
.btn:not(.is-done) .btn__b, .btn.is-done .btn__a { position: absolute; inset: 0; }
.btn { overflow: hidden; }
.btn__b { opacity: 0; }
.btn__b svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.is-done .btn__bg { background: linear-gradient(180deg, #2b2d32, var(--ink)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(23, 24, 27, 0.3), 0 8px 18px -8px rgba(23, 24, 27, 0.5); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (hover: hover) {
  .leg:hover { background: #f5f4f0; }
}
