/* A stationary right rail, with visual choices rather than nested menus. */
html[data-theme] .settings-panel {
  position: fixed; z-index: 30; inset: 16px 16px 16px auto;
  width: min(420px, calc(100vw - 32px)); max-height: none; padding: 0;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 24px;
  background: var(--ui-surface); color: var(--ui-ink); border: 0;
  box-shadow: 0 0 0 1px var(--ui-line), 0 16px 48px rgba(0,0,0,.22), 0 4px 12px rgba(0,0,0,.12);
  transform: translateX(16px); opacity: 0; pointer-events: none;
  transition: transform 260ms cubic-bezier(.2,0,0,1), opacity 180ms ease-out;
}
html[data-theme] .settings-panel[hidden] { display: none; }
html[data-theme] .settings-panel.is-open { transform: translateX(0); opacity: 1; pointer-events: auto; }
html[data-theme] .settings-panel.is-closing { transform: translateX(8px); opacity: 0; transition-duration: 150ms; }
html[data-theme] .settings-head { flex: 0 0 auto; padding: 22px 24px 18px; align-items: center; }
.customize-eyebrow { margin: 0 0 5px; color: var(--ui-muted); font-size: 10px; font-weight: 500; letter-spacing: .1em; }
html[data-theme] .settings-head h2 { font-size: 25px; line-height: 1.2; letter-spacing: -.04em; }
html[data-theme] .settings-head button { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--ui-raised); font-size: 25px; }
.customize-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px 24px; scrollbar-width: thin; }
.customize-section { margin: 0; padding: 16px 0; border-top: 1px solid var(--ui-line); }
.customize-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.customize-section h3 { margin: 0; font-size: 14px; font-weight: 500; letter-spacing: -.015em; }
.customize-section-head > span, .customize-hint, .customize-rules { color: var(--ui-muted); font-size: 11px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.customize-hint { margin: 0 0 14px; }
.customize-section-head button { min-height: 40px; padding: 0 8px; margin: -8px -8px -8px 0; border: 0; color: var(--ui-ink); background: transparent; font-size: 11px; border-radius: 8px; }
.customize-section-head button span { margin-left: 5px; font-size: 16px; }
html[data-theme] .settings-panel .surface-options { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; padding: 0; }
html[data-theme] .settings-panel .surface-option { position: relative; display: block; padding: 3px; min-height: 60px; aspect-ratio: 1.25; border: 0; border-radius: 12px; background: var(--ui-raised); box-shadow: 0 0 0 1px var(--ui-line); transform: none; overflow: hidden; transition: scale 150ms ease-out, box-shadow 150ms ease-out; }
html[data-theme] .settings-panel .surface-option.selected { box-shadow: 0 0 0 2px var(--ui-accent); }
.settings-panel .surface-option.selected::after { content: '✓'; position: absolute; right: 7px; bottom: 7px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; background: var(--ui-accent); font-size: 11px; }
html[data-theme] .settings-panel .swatch { display: block; width: 100%; height: 100%; border: 0; border-radius: 9px; background-size: cover; }
.settings-panel .swatch-studio { background: linear-gradient(135deg,#202020,#020202); }
html[data-theme] .settings-panel .day-scene-note { margin: 0 0 12px; font-size: 11px; }
html[data-theme] .settings-panel .cover-list, html[data-theme] .cover-dialog .cover-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card { position: relative; display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 8px; border: 0; border-radius: 16px; background: var(--ui-raised); box-shadow: 0 0 0 1px var(--ui-line); transform: none; transition: scale 150ms ease-out, box-shadow 150ms ease-out, background-color 150ms ease-out; }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card:hover { background: var(--ui-floating); transform: none; }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ui-accent); }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-preview { display: grid; place-items: center; flex: 0 0 92px; width: 100%; height: 92px; padding: 0; border: 0; background: transparent; overflow: hidden; filter: none; }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-preview img { width: 100%; height: 100%; object-fit: contain; filter: none; opacity: 1; }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card[data-locked="true"] .cover-preview img { opacity: .65; filter: saturate(.65); }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card-copy { width: 100%; text-align: center; }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card-copy strong { display: grid; place-items: center; min-height: 33px; font-size: 11px; font-weight: 500; line-height: 1.5; text-wrap: balance; }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card-copy em { display: block; min-height: 30px; margin: 2px 0 0; color: var(--ui-muted); font-size: 10px; line-height: 1.5; font-style: normal; font-variant-numeric: tabular-nums; }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card[aria-pressed="true"] em { color: var(--ui-ink); }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card-indicator { position: absolute; top: 7px; right: 7px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ui-surface); color: var(--ui-muted); }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card[aria-pressed="true"] .cover-card-indicator { background: var(--ui-accent); color: #fff; }
html[data-theme] :is(.settings-panel,.cover-dialog) .cover-card-indicator svg { width: 12px; height: 12px; }
.customize-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
html[data-theme] .customize-action { display: flex; justify-content: center; align-items: center; gap: 10px; min-width: 0; min-height: 64px; padding: 10px; border: 0; border-radius: 14px; background: var(--ui-raised); color: var(--ui-ink); text-align: left; font: 400 12px/1.4 var(--ui-font); cursor: pointer; transition: background-color 160ms ease, scale 160ms cubic-bezier(.2,0,0,1); }
.customize-action > svg { width: 20px; height: 20px; flex: 0 0 20px; }
.customize-action small { display: block; margin-top: 3px; color: var(--ui-muted); font-size: 10px; }
html[data-theme] .customize-action:hover { background: var(--ui-floating); }
html[data-theme] .customize-action:active { scale: .96; }
.sound-waves, .sound-cross { transform-box: fill-box; transform-origin: center; transition: opacity 180ms ease, scale 180ms cubic-bezier(.2,0,0,1), filter 180ms ease; }
.sound-cross, #sound-toggle[aria-pressed="false"] .sound-waves { opacity: 0; scale: .25; filter: blur(4px); }
#sound-toggle[aria-pressed="false"] .sound-cross { opacity: 1; scale: 1; filter: blur(0); }
#reset-confirmation { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--ui-raised); }
#reset-confirmation[hidden] { display: none; }
#reset-confirmation p { max-width: none; margin: 0 0 10px; }
#reset-confirmation > div { display: flex; flex-wrap: wrap; gap: 6px; }
#reset-confirmation button { min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px; background: var(--ui-floating); color: var(--ui-ink); font: 400 11px/1.4 var(--ui-font); cursor: pointer; }
#reset-confirmation #reset-confirm { background: var(--ui-ink); color: var(--ui-bg); }
.edge-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; margin-top: 14px; color: var(--ui-ink); font-size: 12px; cursor: pointer; }
.edge-setting > span { flex: 1; }
.edge-setting small { display: block; max-width: 250px; margin-top: 4px; color: var(--ui-muted); font-size: 11px; line-height: 1.5; }
:is(#wrap-toggle, #grain-toggle) { appearance: none; -webkit-appearance: none; flex: 0 0 44px; width: 44px; height: 26px; margin: 0; border: 0; border-radius: 999px; background: var(--ui-floating); box-shadow: inset 0 0 0 1px var(--ui-line); cursor: pointer; transition: background-color 180ms ease; }
:is(#wrap-toggle, #grain-toggle)::before { content: ""; display: block; width: 20px; height: 20px; margin: 3px; border-radius: 50%; background: var(--ui-muted); transition: transform 180ms cubic-bezier(.2,0,0,1), background-color 180ms ease; }
:is(#wrap-toggle, #grain-toggle):checked { background: var(--ui-accent); }
:is(#wrap-toggle, #grain-toggle):checked::before { transform: translateX(18px); background: #fff; }
:is(#wrap-toggle, #grain-toggle):disabled { cursor: default; opacity: .65; }
.customize-action:focus-visible, :is(#wrap-toggle, #grain-toggle):focus-visible, #reset-confirmation button:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; }
#mobile-cover-reset-slot .customize-play-controls { margin: 16px 0; }
html[data-theme] .settings-panel button:active { scale: .96; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html[data-theme] .settings-panel, html[data-theme] .settings-panel button, .phone-image-previous.is-unlock-reveal, .customize-action, :is(#wrap-toggle, #grain-toggle), :is(#wrap-toggle, #grain-toggle)::before, .sound-waves, .sound-cross { transition: none; }
}

/* Keep the handset and LCD anchored while its old shell wipes away. */
.cover-reveal-shutter { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; transform: translateX(0); }
.cover-reveal-shutter.is-unlock-reveal, .phone-image-previous.is-unlock-reveal {
  opacity: 1; transform: translateX(0); transition: transform 700ms cubic-bezier(.2,0,0,1); will-change: transform;
}
.cover-reveal-shutter.is-unlock-reveal.is-fading { transform: translateX(100%); }
.phone-image-previous.is-unlock-reveal.is-fading { opacity: 1; transform: translateX(-100%); }
.cover-reveal-glint {
  position: absolute; z-index: 3; inset: 0; pointer-events: none; overflow: hidden;
  mask-image: var(--normal-art); mask-size: 100% 100%; mask-repeat: no-repeat;
  -webkit-mask-image: var(--normal-art); -webkit-mask-size: 100% 100%;
}
.cover-reveal-glint::before {
  content: ""; position: absolute; inset: -20%; opacity: 0;
  background: linear-gradient(110deg,transparent 30%,rgba(230,255,177,.55) 48%,rgba(255,255,255,.65) 50%,transparent 66%);
  transform: translateX(-80%);
}
.phone.is-cover-unlocking .cover-reveal-glint::before { animation: cover-shine 700ms cubic-bezier(.2,0,0,1) both; }
@keyframes cover-shine {
  0% { transform: translateX(-80%); opacity: 0; }
  18% { opacity: .75; }
  72% { opacity: .55; }
  100% { transform: translateX(80%); opacity: 0; }
}
.cover-sparkles { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.cover-sparkles i {
  position: absolute; width: 9px; height: 9px; opacity: 0; background: #d7ff82;
  clip-path: polygon(38% 0,62% 0,62% 38%,100% 38%,100% 62%,62% 62%,62% 100%,38% 100%,38% 62%,0 62%,0 38%,38% 38%);
}
.cover-sparkles i:nth-child(1) { left: 24%; top: 14%; --spark-x: -18px; --spark-y: -24px; }
.cover-sparkles i:nth-child(2) { left: 76%; top: 14%; --spark-x: 18px; --spark-y: -24px; }
.cover-sparkles i:nth-child(3) { left: 21%; top: 28%; --spark-x: -16px; --spark-y: -12px; }
.cover-sparkles i:nth-child(4) { left: 78%; top: 28%; --spark-x: 16px; --spark-y: -12px; }
.cover-sparkles i:nth-child(5) { left: 32%; top: 8%; --spark-x: -12px; --spark-y: -18px; }
.cover-sparkles i:nth-child(6) { left: 68%; top: 8%; --spark-x: 12px; --spark-y: -18px; }
.phone.is-cover-unlocking .cover-sparkles i { animation: cover-spark 650ms cubic-bezier(.2,0,0,1) both; }
.phone.is-cover-unlocking .cover-sparkles i:nth-child(even) { animation-delay: 100ms; }
@keyframes cover-spark {
  0% { transform: translate(0,0) scale(.6); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(var(--spark-x),var(--spark-y)) scale(.8); opacity: 0; }
}
/* A new cover arrives like an SMS on the old handset. */
.cover-achievement {
  --achievement-safe-top: 8px;
  position: fixed; z-index: 21; left: var(--achievement-x,50%); top: max(var(--achievement-safe-top),var(--achievement-y,8px));
  width: min(316px,calc(100vw - 24px)); padding: 12px; border-radius: 9px;
  color: #263421; background: linear-gradient(145deg,#c5d39e,#aebb82);
  box-shadow: 0 0 0 3px #30362d, 0 0 0 4px rgba(255,255,255,.16), inset 0 1px 5px rgba(38,52,33,.14), 0 12px 28px rgba(0,0,0,.3);
  transform: translate(-50%,6px); opacity: 0; pointer-events: none;
  transition: opacity 180ms ease-in, transform 180ms ease-in;
}
.cover-achievement.is-visible { opacity: 1; transform: translate(-50%,0); transition: opacity 220ms ease-out, transform 280ms cubic-bezier(.2,0,0,1); }
.achievement-header {
  display: flex; align-items: center; gap: 8px; padding-bottom: 7px; margin-bottom: 8px;
  box-shadow: 0 1px 0 rgba(38,52,33,.22); font: 400 9px/1.4 var(--nokia-font);
}
.achievement-header svg { flex: 0 0 auto; width: 20px; height: 16px; }
.achievement-sender { margin-left: auto; opacity: .6; }
.achievement-message { display: flex; align-items: center; gap: 14px; }
.achievement-message > img { width: 52px; height: 78px; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 3px 2px rgba(38,52,33,.2)); }
.achievement-copy { display: grid; gap: 7px; min-width: 0; }
.achievement-points { display: flex; align-items: baseline; gap: 8px; margin: 0; font: 400 26px/1.1 var(--nokia-font); font-variant-numeric: tabular-nums; }
.achievement-points > span:last-child { font-size: 9px; opacity: .65; }
.achievement-copy strong { font: 400 17px/1.3 var(--nokia-font); text-wrap: balance; }
.achievement-copy > span { font: 500 10px/1.3 var(--ui-font); text-wrap: pretty; opacity: .75; }
.cover-achievement.is-visible :is(.achievement-header,.achievement-message) { animation: sms-content-in 220ms cubic-bezier(.2,0,0,1) both; }
.cover-achievement.is-visible .achievement-message { animation-delay: 100ms; }
@keyframes sms-content-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 700px) {
  .cover-achievement { --achievement-safe-top: max(8px,env(safe-area-inset-top)); width: min(264px,calc(100vw - 24px)); padding: 10px 12px; }
  .achievement-header { padding-bottom: 7px; margin-bottom: 8px; font-size: 8px; }
  .achievement-message { gap: 12px; }
  .achievement-message > img { width: 42px; height: 63px; }
  .achievement-copy { gap: 5px; }
  .achievement-points { font-size: 22px; }
  .achievement-copy strong { font-size: 14px; }
  .achievement-copy > span { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .cover-reveal-shutter.is-unlock-reveal, .phone-image-previous.is-unlock-reveal,
  .cover-achievement, .cover-achievement.is-visible { transition: none; will-change: auto; }
  .cover-achievement.is-visible :is(.achievement-header,.achievement-message) { animation: none; }
  .phone.is-cover-unlocking .cover-reveal-glint::before, .phone.is-cover-unlocking .cover-sparkles i { animation: none; opacity: 0; }
}
