/* Годинник для iPad 2 (Safari 9). Розрахунок на 1024×768, альбомна орієнтація. */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-user-select: none; user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #121833; color: #fff; }
body { font-family: "Avenir Next", "Nunito", "Segoe UI", "Helvetica Neue", Arial, sans-serif; font-weight: 600; -webkit-text-size-adjust: 100%; -webkit-touch-callout: none; }

/* iOS Safari передає дотик обробникам лише для «клікабельних» елементів — cursor:pointer робить їх такими */
[data-go], .nav-btn, .back, .big-btn, .preset, .task, .r-item, #taskList, #routineList, #presets, #night, #dial, #popup, .night-exit { cursor: pointer; }

.screen { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: none; }
.screen.active { display: block; }

.card { background: #1d2550; border-radius: 28px; padding: 18px 22px; }

/* ---------- Головний екран ---------- */
#home { background: #121833; background: -webkit-radial-gradient(20% 10%, circle, #263070 0%, #121833 60%); background: radial-gradient(circle at 20% 10%, #263070 0%, #121833 60%); }
.col-left { position: absolute; left: 32px; top: 22px; width: 548px; }
.col-right { position: absolute; right: 32px; top: 30px; width: 400px; bottom: 132px; }

.greeting { font-size: 28px; color: #ffd166; font-weight: 700; }
.clock { font-size: 178px; line-height: 1; font-weight: 700; letter-spacing: -4px; margin: 2px 0 0 -6px; color: #fff; text-shadow: 0 6px 30px rgba(120,140,255,.35); }
.clock .colon { position: relative; top: -14px; margin: 0 4px; color: #7c8cff; }
.clock .colon.dim { opacity: .25; }
.date { font-size: 30px; color: #b9c2ff; margin: 4px 0 18px; text-transform: lowercase; }
.date:first-letter { text-transform: uppercase; }

.weather { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; margin-bottom: 14px; }
.w-now { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; width: 250px; }
.w-icon { font-size: 62px; margin-right: 14px; line-height: 1; }
.w-temp { font-size: 50px; font-weight: 700; line-height: 1; }
.w-desc { font-size: 18px; color: #b9c2ff; margin-top: 4px; }
.w-days { display: -webkit-flex; display: flex; -webkit-flex: 1; flex: 1; -webkit-justify-content: space-between; justify-content: space-between; }
.w-day { text-align: center; width: 84px; }
.w-day .d-name { font-size: 16px; color: #b9c2ff; }
.w-day .d-icon { font-size: 30px; margin: 2px 0; }
.w-day .d-t { font-size: 17px; }
.w-day .d-t i { font-style: normal; color: #8b94c9; }

.power-title { font-size: 20px; margin-bottom: 10px; }
.power-title.off { color: #ff8a80; }
.power-bar { position: relative; height: 22px; border-radius: 11px; background: #3ccf8e; overflow: hidden; }
.power-bar.unknown { background: #39407a; }
.power-off { position: absolute; top: 0; bottom: 0; background: #ff5d73; background-image: -webkit-repeating-linear-gradient(45deg, rgba(255,255,255,.18) 0, rgba(255,255,255,.18) 6px, transparent 6px, transparent 12px); background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.18) 0, rgba(255,255,255,.18) 6px, transparent 6px, transparent 12px); }
.power-now { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: #fff; border-radius: 2px; z-index: 2; box-shadow: 0 0 8px #fff; }
.power-scale { display: -webkit-flex; display: flex; -webkit-justify-content: space-between; justify-content: space-between; font-size: 13px; color: #8b94c9; margin-top: 4px; }

.tasks { height: 100%; display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; }
.tasks-head { display: -webkit-flex; display: flex; -webkit-justify-content: space-between; justify-content: space-between; -webkit-align-items: center; align-items: center; margin-bottom: 12px; }
.tasks-title { font-size: 28px; font-weight: 700; }
.stars { font-size: 24px; background: #2c3570; border-radius: 20px; padding: 4px 14px; color: #ffd166; }
.stars.bump { -webkit-animation: bump .6s; animation: bump .6s; }
.task-list { -webkit-flex: 1; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.task { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; background: #283168; border-radius: 20px; padding: 14px 16px; margin-bottom: 10px; font-size: 22px; line-height: 1.25; -webkit-transition: opacity .3s, background .3s; transition: opacity .3s, background .3s; }
.task .box { -webkit-flex: none; flex: none; width: 40px; height: 40px; border-radius: 12px; border: 3px solid #7c8cff; margin-right: 14px; text-align: center; line-height: 34px; font-size: 26px; color: transparent; -webkit-transition: all .25s; transition: all .25s; }
.task .txt { -webkit-flex: 1; flex: 1; }
.task .when { display: block; font-size: 16px; color: #ffd166; margin-top: 2px; }
.task.done { background: #213a3f; opacity: .7; }
.task.done .box { background: #3ccf8e; border-color: #3ccf8e; color: #fff; }
.task.done .txt { text-decoration: line-through; color: #a6d9c3; }
.task.later { opacity: .55; }
.empty { text-align: center; color: #8b94c9; font-size: 22px; padding: 40px 10px; line-height: 1.4; }
.empty b { display: block; font-size: 60px; margin-bottom: 10px; }

.nav { position: absolute; left: 32px; right: 32px; bottom: 22px; height: 92px; display: -webkit-flex; display: flex; }
.nav-btn { -webkit-flex: 1; flex: 1; margin: 0 8px; border-radius: 28px; font-size: 24px; font-weight: 700; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center; color: #1b1f3b; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.nav-btn:first-child { margin-left: 0; } .nav-btn:last-child { margin-right: 0; }
.nav-btn span { font-size: 38px; margin-right: 10px; }
.nav-btn:active, .big-btn:active { -webkit-transform: translateY(4px); transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.c-timer { background: #ff8a65; } .c-morning { background: #ffd166; } .c-evening { background: #a594ff; } .c-night { background: #4fd1c5; }

.offline { position: absolute; right: 36px; top: 6px; font-size: 13px; color: #ff8a80; display: none; }
.offline.show { display: block; }
.sound-hint { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; font-size: 13px; color: #8b94c9; }
.sound-hint.hide { display: none; }

.back { position: absolute; left: 24px; top: 20px; font-size: 26px; padding: 12px 22px; background: rgba(255,255,255,.1); border-radius: 22px; z-index: 5; }

.big-btn { display: inline-block; text-align: center; border-radius: 26px; font-size: 28px; font-weight: 700; padding: 20px 30px; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.big-btn.go { background: #3ccf8e; color: #10301f; }
.big-btn.pause { background: #ffd166; color: #3b2c00; }
.big-btn.ghost { background: rgba(255,255,255,.12); color: #fff; box-shadow: 0 6px 0 rgba(0,0,0,.2); }

/* ---------- Таймер ---------- */
#timer { background: #121833; }
.timer-wrap { position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; padding: 60px 40px 30px 30px; }
.dial-box { width: 600px; height: 600px; -webkit-flex: none; flex: none; position: relative; }
#dial { display: block; width: 600px; height: 600px; }
.dial-face { fill: #fdfbf5; }
.dial-center { fill: #fff; stroke: #e7e3d6; stroke-width: 4; }
.face-ink { fill: #2b2f4a; }
.face-mouth { fill: none; stroke: #2b2f4a; stroke-width: 12; stroke-linecap: round; }
#knob { fill: #fff; stroke: #2b2f4a; stroke-width: 5; }
.tick { stroke: #2b2f4a; stroke-linecap: round; }
.tick-num { fill: #fff; font-size: 26px; font-weight: 700; text-anchor: middle; font-family: "Avenir Next", "Nunito", Arial, sans-serif; }
.timer-side { -webkit-flex: 1; flex: 1; padding-left: 30px; text-align: center; }
.timer-digits { font-size: 104px; font-weight: 700; line-height: 1; letter-spacing: -2px; }
.timer-hint { font-size: 19px; color: #b9c2ff; margin: 10px 0 22px; min-height: 26px; }
.presets { margin-bottom: 24px; }
.preset { display: inline-block; width: 78px; height: 60px; line-height: 60px; margin: 5px; border-radius: 18px; background: #283168; font-size: 22px; }
.preset small { font-size: 14px; color: #b9c2ff; }
.timer-buttons { white-space: nowrap; }
.timer-buttons .big-btn { width: 150px; margin: 0 4px; padding: 20px 0; font-size: 25px; }
#timer.ringing { -webkit-animation: flash 1s infinite; animation: flash 1s infinite; }

/* ---------- Розпорядок ---------- */
#routine { background: #2a2350; }
#routine.morning { background: #ffb347; background: -webkit-linear-gradient(top, #ffcf6e, #ff9f6e); background: linear-gradient(to bottom, #ffcf6e, #ff9f6e); color: #3b2200; }
#routine.evening { background: #2a2350; background: -webkit-linear-gradient(top, #2b2160, #46307a); background: linear-gradient(to bottom, #2b2160, #46307a); }
#routine.morning .back { background: rgba(255,255,255,.35); }
.routine-head { position: absolute; left: 200px; right: 40px; top: 24px; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; }
.routine-title { font-size: 40px; font-weight: 700; width: 230px; }
.routine-progress { -webkit-flex: 1; flex: 1; height: 26px; background: rgba(0,0,0,.18); border-radius: 13px; overflow: hidden; margin: 0 20px; }
.routine-progress div { height: 100%; width: 0; background: #3ccf8e; border-radius: 13px; -webkit-transition: width .5s; transition: width .5s; }
.routine-count { font-size: 30px; font-weight: 700; }
.routine-list { position: absolute; left: 40px; right: 40px; top: 110px; bottom: 30px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.r-item { float: left; width: 48.5%; margin: 0 3% 18px 0; height: 120px; border-radius: 28px; background: rgba(255,255,255,.9); color: #2b2f4a; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; padding: 0 24px; font-size: 27px; font-weight: 700; box-shadow: 0 6px 0 rgba(0,0,0,.12); -webkit-transition: background .3s; transition: background .3s; }
.r-item:nth-child(2n) { margin-right: 0; }
#routine.evening .r-item { background: rgba(255,255,255,.12); color: #fff; }
.r-item .r-emo { font-size: 46px; margin-right: 18px; width: 56px; text-align: center; }
.r-item .r-check { margin-left: auto; width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(0,0,0,.2); text-align: center; line-height: 46px; font-size: 32px; color: transparent; }
#routine.evening .r-item .r-check { border-color: rgba(255,255,255,.35); }
.r-item.done { background: #3ccf8e !important; color: #fff !important; }
.r-item.done .r-check { background: #fff; border-color: #fff; color: #3ccf8e; -webkit-animation: bump .5s; animation: bump .5s; }

/* ---------- Нічник ---------- */
#night { background: #000; }
.night-glow { position: absolute; left: 0; top: 0; right: 0; bottom: 0; opacity: 0; -webkit-transition: opacity 1.2s; transition: opacity 1.2s;
  background: -webkit-radial-gradient(50% 60%, circle, rgba(255,150,60,.95) 0%, rgba(255,110,40,.55) 30%, rgba(120,40,10,.2) 60%, rgba(0,0,0,0) 80%);
  background: radial-gradient(circle at 50% 60%, rgba(255,150,60,.95) 0%, rgba(255,110,40,.55) 30%, rgba(120,40,10,.2) 60%, rgba(0,0,0,0) 80%); }
.night-clock { position: absolute; font-size: 120px; font-weight: 600; color: #ff9a4d; opacity: .35; width: 400px; text-align: center; -webkit-transition: left 2s, top 2s; transition: left 2s, top 2s; }
.night-exit { position: absolute; right: 18px; top: 14px; width: 60px; height: 60px; line-height: 60px; text-align: center; font-size: 26px; color: rgba(255,255,255,.18); }

/* ---------- Світанок ---------- */
#sunrise { background: #0b0f2a; overflow: hidden; }
.sun { position: absolute; left: 50%; width: 360px; height: 360px; margin-left: -180px; border-radius: 50%; background: #ffd36b; box-shadow: 0 0 120px 60px rgba(255,190,90,.6); }
.sunrise-clock { position: absolute; top: 70px; width: 100%; text-align: center; font-size: 150px; font-weight: 700; color: #fff; text-shadow: 0 4px 20px rgba(0,0,0,.3); }
.sunrise-msg { position: absolute; top: 260px; width: 100%; text-align: center; font-size: 36px; color: #fff; }
.big-btn.wake { position: absolute; left: 50%; bottom: 70px; width: 440px; margin-left: -220px; background: #fff; color: #e2672f; font-size: 36px; display: none; }
.big-btn.wake.show { display: block; -webkit-animation: pulse 1.6s infinite; animation: pulse 1.6s infinite; }

/* ---------- Спливаюче вікно ---------- */
.popup { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: rgba(8,10,30,.75); display: none; z-index: 50; }
.popup.show { display: block; }
.popup-card { position: absolute; left: 50%; top: 50%; width: 640px; margin-left: -320px; -webkit-transform: translateY(-50%); transform: translateY(-50%); background: #fff; color: #2b2f4a; border-radius: 36px; padding: 36px 40px 40px; text-align: center; -webkit-animation: pop .4s; animation: pop .4s; }
.popup-emoji { font-size: 90px; line-height: 1.1; }
.popup-title { font-size: 26px; color: #7c8cff; margin-top: 6px; }
.popup-text { font-size: 40px; font-weight: 700; margin: 12px 0 30px; line-height: 1.2; }
.popup-buttons .big-btn { margin: 0 8px; min-width: 220px; }
.popup .big-btn.ghost { background: #eceefa; color: #2b2f4a; }

#confetti { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; overflow: hidden; }
.conf { position: absolute; top: -40px; font-size: 40px; -webkit-animation: fall 2.4s linear forwards; animation: fall 2.4s linear forwards; }

@-webkit-keyframes bump { 0% { -webkit-transform: scale(1); } 40% { -webkit-transform: scale(1.35); } 100% { -webkit-transform: scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@-webkit-keyframes pop { from { -webkit-transform: translateY(-50%) scale(.7); opacity: 0; } to { -webkit-transform: translateY(-50%) scale(1); opacity: 1; } }
@keyframes pop { from { transform: translateY(-50%) scale(.7); opacity: 0; } to { transform: translateY(-50%) scale(1); opacity: 1; } }
@-webkit-keyframes pulse { 0%, 100% { -webkit-transform: scale(1); } 50% { -webkit-transform: scale(1.06); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@-webkit-keyframes flash { 0%, 100% { background: #121833; } 50% { background: #3d2b6b; } }
@keyframes flash { 0%, 100% { background: #121833; } 50% { background: #3d2b6b; } }
@-webkit-keyframes fall { to { -webkit-transform: translateY(860px) rotate(540deg); } }
@keyframes fall { to { transform: translateY(860px) rotate(540deg); } }

/* ---------- Портретна орієнтація ---------- */
@media (orientation: portrait) {
  .col-left { left: 28px; right: 28px; width: auto; }
  .col-right { left: 28px; right: 28px; width: auto; top: 590px; }
  .timer-wrap { -webkit-flex-direction: column; flex-direction: column; padding-top: 80px; }
  .dial-box, #dial { width: 560px; height: 560px; }
  .timer-side { padding: 10px 0 0; }
  .timer-digits { font-size: 80px; }
  .routine-head { left: 24px; top: 96px; }
  .routine-list { top: 180px; }
  .r-item { width: 100%; margin-right: 0; }
}
