/* Fonts: Literata (heading) and Inter (UI), SIL Open Font License, Latin + Latin Extended only. */
@font-face {
  font-family: 'Literata';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url('fonts/literata-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Literata';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url('fonts/literata-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-read: 'Literata', Georgia, 'Times New Roman', serif;

  /* light (paper) */
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #f8f4ea;
  --text: #1e2430;
  --text-2: #4c5565;
  --muted: #6f7786;
  --border: #e2dccd;
  --border-strong: #cfc6b2;
  --accent: #0f6e6a;
  --accent-2: #128079;
  --accent-soft: #d9ece9;
  --accent-text: #ffffff;
  --warn: #9a6400;
  --warn-soft: #fbedc9;
  --bad: #b3261e;
  --bad-soft: #f8dcd9;
  --shadow-1: 0 1px 2px rgba(40, 32, 15, 0.06), 0 1px 1px rgba(40, 32, 15, 0.04);
  --shadow-2: 0 6px 20px rgba(40, 32, 15, 0.1), 0 2px 6px rgba(40, 32, 15, 0.06);
  /* letter tiles: hue comes from the title, lightness from the theme */
  --harf-zemin: 42% 89%;
  --harf-yazi: 50% 30%;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b212a;
    --surface-2: #222a35;
    --text: #e7e9ec;
    --text-2: #b8c0cb;
    --muted: #8f99a8;
    --border: #2c3542;
    --border-strong: #3a4554;
    --accent: #4fb8ae;
    --accent-2: #63c7bd;
    --accent-soft: #1d3a38;
    --accent-text: #0d1513;
    --warn: #e0b04f;
    --warn-soft: #3a3016;
    --bad: #ff7a6e;
    --bad-soft: #3d1f1c;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.4);
    --harf-zemin: 28% 24%;
    --harf-yazi: 62% 80%;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1,
h2,
p {
  margin: 0;
}
button,
input {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}

#kok {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(32px + var(--safe-top)) calc(24px + var(--safe-right)) calc(40px + var(--safe-bottom))
    calc(24px + var(--safe-left));
}

/* ---------- header: date, greeting, countdowns ---------- */
.ust-sira {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
}
.ust-ana {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 32px;
}
.simge-dugme {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.simge-dugme:hover {
  background: var(--surface-2);
  color: var(--text);
}
.tarih {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  font-family: var(--font-read);
  font-weight: 600;
  font-size: clamp(1.9rem, 1.2rem + 2.6vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.sayimlar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
.sayim {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 9px 16px 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.kalan {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 42px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kalan small {
  margin-top: 2px;
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.kalan.soz {
  font-size: 0.9rem;
}
.sayim.yakin .kalan {
  background: var(--warn-soft);
  color: var(--warn);
}
.sayim-yazi {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sayim-ad {
  font-weight: 600;
  font-size: 0.92rem;
}
.sayim-gun {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- groups and tiles ---------- */
.grup {
  margin-top: 26px;
}
.grup-baslik {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.grup-baslik h2 {
  font: inherit;
  letter-spacing: inherit;
}
.grup-baslik .dugme {
  min-height: 30px;
  padding: 2px 10px;
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
}
.izgara {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.izgara.buyuk {
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
}
.karo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 64px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
a.karo:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
a.karo:active {
  transform: translateY(0);
  box-shadow: var(--shadow-1);
}
.simge {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.simge.harf {
  background: hsl(var(--ton, 180) var(--harf-zemin));
  color: hsl(var(--ton, 180) var(--harf-yazi));
  font-weight: 700;
  font-size: 1.05rem;
}
.simge.resim {
  background: none;
}
.simge img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}
.yazi {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ad {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.25;
}
.alt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.78rem;
}
.izgara.buyuk .karo {
  gap: 16px;
  min-height: 90px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
}
.izgara.buyuk .simge {
  width: 60px;
  height: 60px;
  border-radius: 14px;
}
.izgara.buyuk .simge.harf {
  font-size: 1.5rem;
}
.izgara.buyuk .ad {
  font-size: 1.08rem;
  font-weight: 650;
}
.izgara.buyuk .alt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  font-size: 0.85rem;
  line-height: 1.35;
}

/* ---------- buttons, inputs ---------- */
.dugme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dugme:hover {
  background: var(--surface-2);
}
.dugme:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.dugme.ana {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.dugme.ana:hover {
  background: var(--accent-2);
}
.dugme.sade {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.dugme.sade:hover {
  background: var(--surface-2);
}
.dugme.tehlike {
  color: var(--bad);
}
.dugme.buyuk {
  min-height: 52px;
  font-size: 1.02rem;
  border-radius: var(--r-lg);
}
.girdi {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
}
.girdi::placeholder {
  color: var(--muted);
}

/* ---------- edit mode ---------- */
.kaldir {
  position: absolute;
  top: -9px;
  right: -9px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--bad);
  box-shadow: var(--shadow-1);
  cursor: pointer;
}
.kaldir:hover {
  background: var(--bad-soft);
}
.kaldir.satir {
  position: static;
  width: 28px;
  height: 28px;
}
.karo.ekle {
  justify-content: center;
  gap: 8px;
  border-style: dashed;
  border-color: var(--border-strong);
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.karo.ekle:hover {
  background: var(--surface-2);
}
.sayim.ekle {
  border-style: dashed;
  border-color: var(--border-strong);
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.ek-form {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
/* a form takes a row of its own, so the tiles next to it keep their height */
.izgara > .ek-form {
  grid-column: 1 / -1;
  max-width: 420px;
}
.sayimlar > .ek-form {
  flex: 1 1 100%;
  max-width: 420px;
}
.ek-form .sira {
  display: flex;
  gap: 8px;
}
.ek-form .sira .dugme {
  flex: 1;
  min-height: 40px;
}
.hata {
  color: var(--bad);
  font-size: 0.85rem;
}
.yeni-grup {
  max-width: 420px;
  margin-top: 26px;
}
.cubuk.duzen {
  position: sticky;
  bottom: calc(12px + var(--safe-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}
.cubuk .sol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.not {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- lock screen, messages ---------- */
.orta {
  display: grid;
  justify-items: center;
  padding-top: 14vh;
}
.kilit-kart {
  display: grid;
  gap: 14px;
  width: min(380px, 100%);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.kilit-simge {
  display: flex;
  justify-content: center;
  color: var(--text-2);
}
.uyari {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 0.9rem;
}
.bekle {
  color: var(--muted);
  text-align: center;
}

/* three big tiles side by side on a tablet held upright */
@media (min-width: 641px) and (max-width: 900px) {
  .izgara.buyuk .karo {
    gap: 12px;
    padding: 14px;
  }
  .izgara.buyuk .simge {
    width: 52px;
    height: 52px;
    border-radius: 12px;
  }
  .izgara.buyuk .ad {
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  #kok {
    padding-top: calc(22px + var(--safe-top));
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
  }
  .sayimlar {
    width: 100%;
  }
  .sayim {
    flex: 1 1 100%;
  }
  .izgara,
  .izgara.buyuk {
    grid-template-columns: 1fr;
  }
  .izgara.buyuk .karo {
    min-height: 84px;
  }
  .grup {
    margin-top: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
