/* 딸기폰 — a toy phone. Layout: full screen on a phone; on wide screens the phone body stands in the middle of a desk. */
:root {
  --ink: #4a3a4f;
  --ink-soft: #7d6d84;
  --cream: #fffaf3;
  --berry: #ff7fa8;
  --berry-dk: #e05a87;
  --mint: #5ccf98;
  --mint-dk: #36a874;
  --butter: #ffe07a;
  --sky: #bfe6ff;
  --lilac: #cdb8ff;
  --desk: #2b2233;
  --body: #ff9ec0;
  --font: 'Jua', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --sb: calc(30px + env(safe-area-inset-top, 0px));
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--desk); color: var(--ink); font-family: var(--font);
  overflow: hidden; overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
}
[hidden] { display: none !important; }
button { font-family: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--butter); outline-offset: 2px; }
.noscript { position: fixed; inset: 0; z-index: 99; display: grid; place-items: center; padding: 24px; background: var(--cream); font: 18px/1.6 sans-serif; text-align: center; }

#phone { position: fixed; inset: 0; display: grid; place-items: center; }
#screen { position: relative; width: 100%; height: 100%; overflow: hidden; background: #000; isolation: isolate; }
/* wide screens: show the toy phone body */
@media (min-width: 620px) {
  #phone { background: radial-gradient(circle at 30% 20%, #3c2f47, var(--desk) 70%); }
  #screen {
    width: min(430px, calc((100vh - 48px) * 0.49)); height: min(900px, calc(100vh - 48px));
    border-radius: 46px; border: 14px solid var(--body);
    box-shadow: 0 0 0 4px #ffc2d6 inset, 0 0 0 3px #e9779e, 0 28px 60px rgba(0,0,0,.45);
    --sb: 30px;
  }
}

/* status bar */
#statusbar {
  position: absolute; z-index: 30; left: 0; right: 0; top: 0; height: var(--sb);
  padding: env(safe-area-inset-top, 0px) max(18px, env(safe-area-inset-right, 0px)) 0 max(18px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; justify-content: space-between; color: #fff; font-size: 15px;
  text-shadow: 0 1px 2px rgba(0,0,0,.25); pointer-events: none;
}
#statusbar.dark { color: var(--ink); text-shadow: none; }
.sb-icons { display: flex; align-items: center; gap: 8px; }
.sb-icons svg { width: 17px; height: 17px; }
.battery { width: 26px; height: 13px; border: 2px solid currentColor; border-radius: 4px; position: relative; padding: 1.5px; }
.battery::after { content: ""; position: absolute; right: -5px; top: 3px; width: 3px; height: 5px; background: currentColor; border-radius: 0 2px 2px 0; }
.battery i { display: block; height: 100%; width: 100%; background: currentColor; border-radius: 1.5px; }

#view { position: absolute; inset: 0; }
.layer { position: absolute; inset: 0; }

/* power off */
.power { background: #050407; display: grid; place-items: center; }
.power-btn { width: 132px; height: 132px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ff9ec0, #e05a87); box-shadow: 0 0 0 10px rgba(255,127,168,.15), 0 0 50px rgba(255,127,168,.45); display: grid; place-items: center; animation: breathe 2.4s ease-in-out infinite; }
.power-btn svg { width: 58px; height: 58px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; }
@keyframes breathe { 50% { transform: scale(1.06); box-shadow: 0 0 0 18px rgba(255,127,168,.1), 0 0 70px rgba(255,127,168,.55); } }
.boot { background: #fff4f8; display: grid; place-items: center; }
.boot canvas { width: 220px; height: 260px; }

/* wallpapers */
.wp-0 { background: radial-gradient(circle at 20% 15%, #ffe0ec 0 18%, transparent 19%), radial-gradient(circle at 80% 70%, #ffd0e3 0 22%, transparent 23%), linear-gradient(160deg, #ffb8d2, #ff8fb5 60%, #ffa8c8); }
.wp-1 { background: radial-gradient(circle at 75% 20%, #fff7c2 0 9%, transparent 10%), linear-gradient(180deg, #8ec9ff, #bfe6ff 55%, #d9f2ff); }
.wp-2 { background: linear-gradient(180deg, #c8f2d9, #8edfb7 70%, #6fd3a8); }
.wp-3 { background: radial-gradient(circle at 30% 30%, #ffffff55 0 3%, transparent 4%) 0 0/60px 60px, linear-gradient(180deg, #5b4b8a, #8e76d9 60%, #c3a6ff); }
.wp-4 { background: linear-gradient(180deg, #fff1b8, #ffd76e 65%, #ffc24d); }
.wp-5 { background: conic-gradient(from 0deg at 50% 120%, #ff9ec4, #ffd56b, #9be3c4, #8cc8ff, #c3a6ff, #ff9ec4); }

/* lock screen */
.lock { display: flex; flex-direction: column; align-items: center; color: #fff; padding: calc(var(--sb) + 30px) 20px calc(34px + env(safe-area-inset-bottom, 0px)); text-shadow: 0 2px 6px rgba(0,0,0,.18); }
.lock-time { font-size: clamp(72px, 24vw, 108px); line-height: 1; letter-spacing: .02em; margin-top: 4vh; font-variant-numeric: tabular-nums; }
.lock-date { font-size: 20px; margin-top: 6px; }
.lock-pet { flex: 1; width: 100%; min-height: 0; display: grid; place-items: center; }
.lock-pet canvas { width: min(240px, 60vw); height: min(240px, 60vw); }
.slider { position: relative; width: min(320px, 86%); height: 68px; border-radius: 40px; background: rgba(255,255,255,.35); box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); backdrop-filter: blur(4px); touch-action: none; }
.slider-label { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 50px; font-size: 21px; color: #fff; animation: shimmer 2s ease-in-out infinite; pointer-events: none; }
@keyframes shimmer { 50% { opacity: .45; } }
.slider-knob { position: absolute; left: 5px; top: 5px; width: 58px; height: 58px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.18); display: grid; place-items: center; }
.slider-knob canvas { width: 46px; height: 46px; pointer-events: none; }
.lock-power { position: absolute; top: calc(var(--sb) + 8px); right: 16px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.25); display: grid; place-items: center; }
.lock-power svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }

/* home screen */
.home { display: flex; flex-direction: column; padding: calc(var(--sb) + 10px) max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); gap: 16px; overflow-y: auto; }
.widget { position: relative; border-radius: 28px; background: linear-gradient(140deg, #3b2f6b, #6a55b8 60%, #9a83e8); color: #fff; min-height: 150px; display: flex; align-items: center; gap: 10px; padding: 14px 16px; box-shadow: 0 8px 0 rgba(0,0,0,.12); overflow: hidden; text-align: left; }
.widget canvas { width: 130px; height: 130px; flex: none; }
.widget-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.widget-title { font-size: 26px; line-height: 1.1; }
.widget-dots { display: flex; gap: 6px; }
.widget-dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.25); }
.widget-dots i.on { background: var(--butter); box-shadow: 0 0 8px var(--butter); }
.apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 10px; align-content: start; }
.app-icon { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.app-icon .tile { width: min(84px, 100%); aspect-ratio: 1; border-radius: 26px; display: grid; place-items: center; box-shadow: 0 5px 0 rgba(0,0,0,.14); position: relative; overflow: hidden; }
.app-icon .tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,.35), transparent 45%); pointer-events: none; }
.app-icon canvas { width: 78%; height: 78%; }
.app-icon span { font-size: 16px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.3); }
.app-icon.pressed .tile { transform: scale(.9); }
.badge { position: absolute; top: -4px; right: calc(50% - 46px); min-width: 26px; height: 26px; border-radius: 13px; background: #ff3b5c; color: #fff; font-size: 15px; display: grid; place-items: center; box-shadow: 0 0 0 3px #fff; animation: pop .5s cubic-bezier(.3,1.7,.5,1); }
@keyframes pop { from { transform: scale(0); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
.app-icon.notify .tile { animation: wiggle .6s ease-in-out 3; }

/* apps */
.app { display: flex; flex-direction: column; background: var(--cream); animation: zoomin .28s cubic-bezier(.2,.9,.3,1.1); }
@keyframes zoomin { from { transform: scale(.6); opacity: 0; border-radius: 40px; } }
.app-head { flex: none; display: flex; align-items: center; gap: 10px; padding: var(--sb) max(10px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px)); background: var(--app-color, var(--berry)); color: #fff; min-height: calc(var(--sb) + 58px); }
.home-btn { width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.95); color: var(--ink); display: grid; place-items: center; box-shadow: 0 4px 0 rgba(0,0,0,.15); flex: none; }
.home-btn svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.home-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.app-title { font-size: 24px; flex: 1; min-width: 0; text-shadow: 0 1px 2px rgba(0,0,0,.15); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-tools { display: flex; gap: 8px; }
.app-body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.app-body > .stage, .stage { position: absolute; inset: 0; display: block; touch-action: none; }
.pad-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* shared kid-size buttons */
.kbtn { min-width: 64px; height: 64px; border-radius: 22px; background: #fff; box-shadow: 0 5px 0 rgba(74,58,79,.18); display: grid; place-items: center; font-size: 17px; color: var(--ink); }
.kbtn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(74,58,79,.18); }
.kbtn canvas { width: 46px; height: 46px; pointer-events: none; }
.kbtn.on { box-shadow: 0 0 0 4px var(--berry), 0 5px 0 rgba(74,58,79,.18); }

/* toast */
#toast { pointer-events: none; position: absolute; z-index: 40; left: 50%; top: calc(var(--sb) + 8px); transform: translateX(-50%); width: min(92%, 380px); display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 24px; background: rgba(255,255,255,.97); box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 18px; color: var(--ink); animation: drop .4s cubic-bezier(.3,1.4,.5,1); }
#toast canvas { width: 54px; height: 54px; flex: none; }
@keyframes drop { from { transform: translate(-50%, -140%); } }

@media (prefers-reduced-motion: reduce) {
  .power-btn, .slider-label, .app-icon.notify .tile { animation: none; }
  .app { animation: none; }
}
