/* the handwriting font, served from this folder (Gochi Hand, SIL Open Font License) */
@font-face {
  font-family: 'Gochi Hand';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/gochi-hand.woff2') format('woff2');
}

:root {
  --paper: #fffdf5;
  --desk: #cfe0e4;
  --ink: #141414;
  --red: #ff6b5e;
  --green: #7ed957;
  --yellow: #ffd84d;
  --blue: #7cc4ff;
  --wobbly: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wobbly2: 18px 225px 18px 255px / 255px 18px 225px 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }

body {
  margin: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--desk);
  color: var(--ink);
  font-family: 'Gochi Hand', 'Patrick Hand', 'Comic Sans MS', 'Chalkboard SE', cursive;
  font-size: 19px;
  line-height: 1.25;
  overflow: hidden;
}
button { font: inherit; color: inherit; }

/* ---------- the phone ---------- */
.phone {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow: hidden;
}
@media (min-width: 520px) and (min-height: 560px) {
  .phone {
    width: 400px;
    height: min(860px, 94vh);
    border: 7px solid var(--ink);
    border-radius: 48px 40px 50px 42px / 44px 50px 42px 48px;
    box-shadow: 9px 11px 0 var(--ink);
  }
}

.status {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px 2px;
  font-size: 19px;
}
.status-icons svg { display: block; }

#app {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 14px 16px;
  -webkit-overflow-scrolling: touch;
}

.homebar { flex: none; display: flex; justify-content: center; padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); border-top: 3px solid var(--ink); border-radius: 30px 12px 0 0 / 6px 9px 0 0; }
#homeBtn {
  width: 74px; height: 30px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wobbly);
  box-shadow: 2px 3px 0 var(--ink);
  transform: rotate(-1.5deg);
  cursor: pointer;
}
#homeBtn:active { translate: 2px 2px; box-shadow: none; }

/* ---------- notification banner + toast ---------- */
.banner {
  position: absolute;
  z-index: 20;
  top: 34px; left: 10px; right: 10px;
  display: flex; align-items: center; gap: 10px;
  text-align: left;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wobbly);
  box-shadow: 3px 5px 0 var(--ink);
  padding: 8px 12px;
  transform: rotate(-1deg);
  cursor: pointer;
  animation: drop .35s ease-out;
}
.banner[hidden] { display: none; }
.banner .face, .banner .ico { width: 46px; height: 46px; flex: none; }
.banner b { display: block; font-weight: 400; font-size: 20px; line-height: 1.1; }
.banner span.txt { display: block; font-size: 17px; line-height: 1.15; color: #444; }
.banner.news { background: #fff7c9; }
.banner.news b { color: #d5281b; }

.toast {
  position: absolute; z-index: 21;
  left: 50%; bottom: 70px;
  transform: translateX(-50%) rotate(-2deg);
  width: max-content; max-width: 84%;
  background: var(--ink); color: #fff;
  border-radius: var(--wobbly2);
  padding: 6px 14px;
  font-size: 18px; text-align: center;
  animation: pop .25s ease-out;
}
.toast[hidden] { display: none; }

/* ---------- doodle boxes and buttons ---------- */
.box {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wobbly);
  box-shadow: 3px 4px 0 var(--ink);
  padding: 10px 12px;
  margin: 12px 2px;
  filter: url(#wob);
}
.box.alt { border-radius: var(--wobbly2); }

.btn {
  font-size: 20px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wobbly);
  box-shadow: 3px 4px 0 var(--ink);
  padding: 6px 12px;
  min-height: 44px;
  cursor: pointer;
  transform: rotate(-2deg);
  filter: url(#wob);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:nth-child(even) { transform: rotate(2.2deg); border-radius: var(--wobbly2); }
.btn:nth-child(3n) { transform: rotate(-0.8deg); }
.btn:active { translate: 2px 3px; box-shadow: 1px 1px 0 var(--ink); }
.btn.big {
  display: block;
  width: 92%;
  margin: 18px auto 8px;
  font-size: 26px;
  padding: 9px 14px;
  background: var(--yellow);
  transform: rotate(-1.4deg);
}
.btn.short.on { background: var(--red); }
.btn.long.on { background: var(--green); }
.btn.chip { font-size: 18px; }
.btn.chip.on { background: var(--yellow); }
.btn.chip:disabled { opacity: .3; box-shadow: none; }

.face { display: inline-block; width: 56px; height: 56px; flex: none; transform: rotate(-4deg); }
.face svg, .logo svg, .ico svg { width: 100%; height: 100%; display: block; }
.label {
  display: inline-block;
  font-size: 16px;
  padding: 0 8px;
  background: var(--blue);
  border: 2.5px solid var(--ink);
  border-radius: var(--wobbly2);
  transform: rotate(-3deg);
}
.fine { font-size: 14px; color: #777; text-align: center; margin: 14px 0 0; }
.credit { margin-top: 6px; }
.credit a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 4px; text-underline-offset: 2px; }

/* ---------- app title bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--paper);
  margin: 0 -14px;
  padding: 4px 14px 6px;
  border-bottom: 3px solid var(--ink);
  border-radius: 0 0 40px 12px / 0 0 8px 12px;
}
.appbar-row { display: flex; align-items: center; gap: 10px; }
.appbar h1 { margin: 0; font-size: 28px; font-weight: 400; flex: 1; line-height: 1.05; min-width: 0; }
.appbar h1 small { display: block; font-size: 15px; color: #555; line-height: 1.1; }
.appbar .face { width: 46px; height: 46px; }
.back {
  flex: none;
  width: 40px; height: 40px;
  font-size: 28px; line-height: 1;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wobbly2);
  box-shadow: 2px 3px 0 var(--ink);
  transform: rotate(-3deg);
  cursor: pointer;
}
.bank {
  flex: none;
  font-size: 22px;
  padding: 0 10px;
  background: var(--green);
  border: 3px solid var(--ink);
  border-radius: var(--wobbly);
  transform: rotate(2deg);
}
.bank.down { background: var(--red); }

.timer { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.timer[hidden] { display: none; }
.timer-track { flex: 1; height: 16px; border: 3px solid var(--ink); border-radius: var(--wobbly); background: #fff; overflow: hidden; }
#timerFill { height: 100%; width: 100%; background: var(--yellow); }
.timer.hurry #timerFill { background: var(--red); }
.timer.hurry #timerNum { animation: shake .3s infinite; }
#timerNum { width: 34px; text-align: right; font-size: 24px; }

/* ---------- lock screen ---------- */
[data-view="lock"] { background: #ffe9a8; text-align: center; }
.lk-time { font-size: 92px; line-height: 1; margin-top: 10px; transform: rotate(-2deg); }
.lk-date { font-size: 20px; margin-bottom: 8px; }
.lk-title { font-size: 30px; font-weight: 400; line-height: normal; margin: 10px 0 0; transform: rotate(1.5deg); }
[data-view="lock"] .box { text-align: left; }
.how { margin: 4px 0 0; padding-left: 24px; }
.how li { margin: 4px 0; }

/* ---------- home screen ---------- */
[data-view="home"] { background: #d8efff; }
.home-top { min-height: 78px; padding-top: 6px; text-align: center; font-size: 30px; line-height: 1; }
.home-top small { display: block; font-size: 18px; color: #456; margin-top: 4px; }
.widget { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.widget small { display: block; font-size: 16px; color: #555; }
.widget .big { font-size: 34px; line-height: 1; }
.apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 6px; margin-top: 22px; }
.app { position: relative; background: none; border: 0; padding: 0; cursor: pointer; text-align: center; font-size: 15px; line-height: 1.1; }
.app .ico {
  display: block;
  width: 62px; height: 62px;
  margin: 0 auto 4px;
  filter: drop-shadow(3px 4px 0 var(--ink));
}
.app:nth-child(odd) .ico { transform: rotate(-3deg); }
.app:nth-child(even) .ico { transform: rotate(2.5deg); }
.app:active .ico { translate: 2px 3px; filter: none; }
.badge {
  position: absolute; top: -8px; right: 6px; z-index: 2;
  min-width: 26px; height: 26px; padding: 0 4px;
  background: #e2392b; color: #fff;
  border: 3px solid var(--ink);
  border-radius: 50% 45% 52% 48%;
  font-size: 17px; line-height: 20px;
  animation: pop .3s ease-out;
}

/* ---------- messages ---------- */
.row {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: none; border: 0; border-bottom: 2.5px dashed #c9c4b4;
  padding: 9px 2px; text-align: left; cursor: pointer;
}
.row .who { flex: 1; min-width: 0; }
.row b { display: block; font-weight: 400; font-size: 21px; line-height: 1.1; }
.row .prev { display: block; font-size: 17px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.unread b::after { content: ' NEW'; color: #e2392b; font-size: 16px; }
.row.unread .prev { color: var(--ink); }
.dot { flex: none; width: 16px; height: 16px; background: #e2392b; border: 3px solid var(--ink); border-radius: 50% 44% 52% 47%; }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; border-bottom: 2.5px dashed #c9c4b4; }
.setting b { display: block; font-weight: 400; font-size: 24px; line-height: 1.1; }
.setting small { display: block; font-size: 16px; color: #666; }
.btn.switch { min-width: 78px; font-size: 22px; background: #e6e6e6; }
.btn.switch.on { background: var(--green); }

.daysep { text-align: center; font-size: 15px; color: #888; margin: 12px 0 2px; }
.bubble {
  display: block;
  width: fit-content; max-width: 84%;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 22px 20px 24px 6px / 18px 24px 20px 6px;
  padding: 6px 12px;
  margin: 9px 0 0 2px;
  font-size: 21px; line-height: 1.2;
  overflow-wrap: anywhere;
  animation: pop .2s ease-out;
  transform-origin: left bottom;
}
.bubble:nth-child(odd) { transform: rotate(-0.8deg); }
.bubble:nth-child(even) { transform: rotate(0.7deg); }
.bubble.old { color: #777; border-color: #999; }
.bubble.typing { letter-spacing: 4px; font-size: 26px; line-height: 1; padding-bottom: 10px; }
.note { text-align: center; font-size: 17px; color: #666; margin-top: 14px; }

/* ---------- stonks ---------- */
canvas.chart {
  display: block;
  width: 100%;
  height: clamp(240px, 44vh, 400px);
  margin: 4px 0 0;
}
.minitip { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 0; font-size: 17px; line-height: 1.2; color: #333; }
.minitip .face { width: 38px; height: 38px; }
.cash { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 2px 0; font-size: 20px; }
.cash.nope { animation: shake .3s 2; color: #d22; }
.tk { margin: 12px 0 0; }
.tk-head { display: flex; align-items: center; gap: 8px; }
.logo { flex: none; width: 40px; height: 40px; transform: rotate(-3deg); }
.tk:nth-child(even) .logo { transform: rotate(3deg); }
.tk-txt { min-width: 0; line-height: 1.1; }
.tk-name { font-size: 20px; }
.tk-name b { font-weight: 400; background: var(--yellow); padding: 0 5px; border-radius: 6px 3px 7px 3px; }
.tk-role { display: block; font-size: 16px; color: #555; }
.px { color: #1f7a2a; font-size: 18px; }
.lines small { color: #666; font-size: 15px; }
.tk-btns { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.tk-btns .btn { white-space: nowrap; padding-left: 6px; padding-right: 6px; }
.tk-btns { gap: 5px; }
.tk-btns .btn { flex: 1 1 0; min-width: 0; padding-left: 2px; padding-right: 2px; }
.tk-btns .dir { flex: 0 0 auto; font-size: 17px; padding-left: 5px; padding-right: 5px; }
.tk-btns .chip { font-size: 15px; }
.tk-btns .gap { display: none; }
.note .res { width: 1.4em; height: 1.4em; }
.tk-btns .gap { width: 2px; flex: none; }

.news { background: #fff7c9; text-align: center; }
.breaking {
  display: inline-block;
  color: #fff; background: #e2392b;
  border: 3px solid var(--ink);
  border-radius: var(--wobbly);
  padding: 0 12px; font-size: 20px;
  transform: rotate(-3deg);
}
.headline { font-size: 25px; line-height: 1.1; margin: 8px 0 4px; }
.stamp {
  display: inline-block;
  font-size: 24px; color: #d5281b;
  border: 4px solid #d5281b;
  border-radius: var(--wobbly2);
  padding: 0 12px;
  transform: rotate(-7deg);
  margin: 4px 0 8px;
  animation: pop .35s ease-out;
}
.pnl { font-size: 46px; line-height: 1; text-align: center; margin: 4px 0; }
.pnl.up { color: #1f9a2c; }
.pnl.dn { color: #d5281b; }
.lines { list-style: none; margin: 8px 0; padding: 0; font-size: 18px; }
.lines li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 2px dashed #bbb; padding: 3px 0; }
.lines .up { color: #1f9a2c; }
.lines .dn { color: #d5281b; }
.joke { font-size: 21px; margin: 8px 0 0; }
.joke::before { content: ''; display: inline-block; width: 1.1em; height: 1.1em; margin-right: 6px; vertical-align: -0.2em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg stroke='%23141414' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M7 33 L10 23 L27 6 L34 13 L17 30Z' fill='%23ffd84d'/%3E%3Cpath d='M7 33 L10 23 L17 30Z' fill='%23141414'/%3E%3Cpath d='M23 10 L30 17' fill='none'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
.center { text-align: center; }

/* ---------- bank (results) ---------- */
.results { text-align: center; }
.rank { font-size: 34px; line-height: 1.05; margin: 8px 0 6px; transform: rotate(-2deg); }
.grid { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.grid .res { width: 46px; height: 46px; }
.grid .res:nth-child(odd) { transform: rotate(-5deg); }
.grid .res:nth-child(even) { transform: rotate(4deg); }
.res { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -0.25em; }
.emo { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.22em; }
.btn.big.alt { background: #fff; font-size: 22px; }
.daynum {
  flex: none; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: var(--wobbly);
  transform: rotate(-3deg);
}
.row:nth-child(even) .daynum { transform: rotate(3deg); background: var(--blue); }
.stats { display: flex; justify-content: space-around; gap: 6px; font-size: 17px; margin: 4px 0 0; }
.stats b { font-weight: 400; font-size: 22px; }
.next { font-size: 18px; color: #444; margin-top: 10px; text-align: center; }
#shareMsg { min-height: 24px; font-size: 18px; text-align: center; }
.sharecard { display: block; width: 78%; margin: 10px auto 0; border: 3px solid var(--ink); border-radius: 10px 4px 12px 5px; box-shadow: 3px 4px 0 var(--ink); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-2deg); }
  75% { transform: translateX(3px) rotate(2deg); }
}
@keyframes pop {
  from { scale: 1.6; opacity: 0; }
  to { scale: 1; opacity: 1; }
}
@keyframes drop {
  from { translate: 0 -120%; }
  to { translate: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}

/* Gochi Hand has no Turkish letters, so Turkish uses Patrick Hand throughout */
html[lang="tr"] body { font-family: 'Patrick Hand', 'Comic Sans MS', 'Chalkboard SE', cursive; font-size: 20px; }

/* language picker in Settings */
.setting.langs { flex-direction: column; align-items: flex-start; }
.langlist { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.langlist .btn { font-size: 19px; padding-left: 12px; padding-right: 12px; }
