:root {
  --ink: #3b2a30;
  --muted: #74636a;
  --line: #eadfe3;
  --soft: #fff7f9;
  --pink: #ffd3de;
  --pink-deep: #ffb9c9;
  --accent: #b4325a;
  --ground: #f3f0f1;
  --edge: #3b2a30;          /* outline of the box, the buttons and the slot */
  --paper: #fff;            /* the sheet, the buttons, the cards */
  --field: #fff;            /* text inputs */
  --chip: rgba(255, 255, 255, .85);
  --lid-top: #ffdde6;
  --rule: #f1dfe5;          /* the lines on the paper */
  --placeholder: #a8969c;
  --err-bg: #ffecec;
  --err-ink: #9a1f2e;
  --warn-bg: #fff1f4;
  --bg-glow: #ffffff;
  --bg-1: #f6f3f4;
  --bg-2: #ebe6e8;
  --shadow-s: rgba(59, 42, 48, .06);
  --shadow-sheet: rgba(59, 42, 48, .22);
  --shadow-lid: rgba(59, 42, 48, .3);
  --shadow-body-1: rgba(59, 42, 48, .38);
  --shadow-body-2: rgba(59, 42, 48, .24);
  --ground-shadow: rgba(59, 42, 48, .2);
  --focus-ring: #fff;
  --inset: 34px; /* how much narrower the paper is than the box */
  color-scheme: light;
}

/* The dark theme: an ember-lit room, and the box wears a devil's face. */
:root[data-theme="dark"] {
  --ink: #f4e7e9;
  --muted: #b99fa5;
  --line: #3a1f26;
  --soft: #1f1014;
  --pink: #5c1620;
  --pink-deep: #8a1f2c;
  --accent: #ff6a5a;
  --ground: #0e0709;
  --edge: #ff4a3d;
  --paper: #1a0d11;
  --field: #120a0d;
  --chip: rgba(40, 14, 18, .85);
  --lid-top: #7a1d28;
  --rule: #2c161b;
  --placeholder: #9a7a82;
  --err-bg: #3a0e14;
  --err-ink: #ffb3ac;
  --warn-bg: #2a1015;
  --bg-glow: #5a1010;
  --bg-1: #160a0c;
  --bg-2: #090405;
  --shadow-s: rgba(0, 0, 0, .5);
  --shadow-sheet: rgba(255, 74, 61, .28);
  --shadow-lid: rgba(255, 74, 61, .4);
  --shadow-body-1: rgba(255, 74, 61, .38);
  --shadow-body-2: rgba(0, 0, 0, .7);
  --ground-shadow: rgba(255, 74, 61, .28);
  --focus-ring: #1a0d11;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* theme.js sets data-lang-wait for an English visitor: the HTML text is Turkish until i18n.js has
 * written English, so the body stays invisible until then (i18n.js removes the flag). If the script
 * never runs, the animation shows the body after 1.5 s: the page is never left blank. */
html[data-lang-wait] body { visibility: hidden; animation: lang-wait-release 0s linear 1.5s forwards; }
@keyframes lang-wait-release { to { visibility: visible; } }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--ground); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  /* A shaded white: light falls from the top centre and fades into a soft grey floor. */
  background:
    radial-gradient(900px 520px at 50% -120px, var(--bg-glow) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  font: 16px/1.55 ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

main {
  max-width: 580px;
  margin: 0 auto;
  padding: 20px 22px calc(56px + env(safe-area-inset-bottom, 0px));
}

.brand { margin: 0; font-weight: 700; letter-spacing: .02em; color: var(--accent); }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 26px 0 0; }
h1 { font-size: clamp(1.7rem, 6vw, 2.2rem); line-height: 1.15; margin: 0 0 10px; text-wrap: balance; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
.lead { margin: 0 auto; max-width: 30em; color: var(--muted); text-wrap: pretty; }
.counter {
  display: inline-block;
  margin: 16px 0 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px var(--shadow-s);
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
}
.counter b { color: var(--accent); }

/* ---------- the box ---------- */
.tipbox { position: relative; margin: 36px 8px 0; }
.tipbox.wobble { animation: wobble .42s ease-in-out; transform-origin: 50% 100%; }

.sheet {
  position: relative;
  z-index: 2;
  margin: 0 var(--inset) -23px; /* bottom edge lands on the middle of the slot */
  padding: 20px 18px 34px;
  background: var(--paper);
  border: 2.5px solid var(--edge);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -10px 30px -12px var(--shadow-sheet);
}
.sheet.dropping { animation: sheet-drop .9s cubic-bezier(.55, 0, .8, .45) forwards; }
.sheet.rising { animation: sheet-drop .5s cubic-bezier(.2, .7, .3, 1) reverse forwards; }
.sheet.over { background: var(--soft); border-style: dashed; }

.lid {
  position: relative;
  z-index: 1;
  height: 52px;
  margin: 0 -8px;
  background: linear-gradient(180deg, var(--lid-top) 0%, var(--pink) 100%);
  border: 3px solid var(--edge);
  border-radius: 16px;
  box-shadow: 0 10px 18px -8px var(--shadow-lid);
}
.slot {
  position: absolute;
  left: calc(var(--inset) - 2px);
  right: calc(var(--inset) - 2px);
  top: 14px;
  height: 12px;
  border-radius: 6px;
  background: var(--edge);
}

.boxbody {
  position: relative;
  margin-top: -3px;
  padding: 20px 22px 26px;
  background: linear-gradient(180deg, var(--paper) 0%, var(--soft) 100%);
  border: 3px solid var(--edge);
  border-radius: 4px 4px 30px 30px;
  /* The box hangs in the air: a wide soft shadow far below it. */
  box-shadow:
    0 46px 60px -28px var(--shadow-body-1),
    0 18px 26px -18px var(--shadow-body-2);
}
.face { display: block; margin: 0 auto 12px; }
.ground {
  width: 72%;
  height: 26px;
  margin: 34px auto 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--ground-shadow), transparent);
}

@keyframes sheet-drop {
  from { transform: translateY(0); clip-path: inset(-40px -40px 0 -40px); }
  to   { transform: translateY(100%); clip-path: inset(-40px -40px 100% -40px); }
}
@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  30% { transform: rotate(-1.4deg); }
  65% { transform: rotate(1deg); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet.dropping, .sheet.rising, .tipbox.wobble { animation: none; }
}

/* ---------- on the paper ---------- */
.label { display: block; font-weight: 650; margin-bottom: 8px; }
.label.small { font-size: .9rem; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); font-size: .82rem; margin-left: 4px; }

textarea, input[type="text"] {
  width: 100%;
  font: inherit;
  color: inherit;
  outline: none;
}
textarea::placeholder, input::placeholder { color: var(--placeholder); }

textarea {
  display: block;
  resize: vertical;
  min-height: 140px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  /* ruled paper */
  line-height: 28px;
  background: repeating-linear-gradient(transparent 0 27px, var(--rule) 27px 28px) local;
}
textarea:focus-visible { box-shadow: 0 0 0 3px var(--focus-ring), 0 0 0 5px var(--pink-deep); border-radius: 4px; }

.attach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; }
.attachbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 2px solid var(--edge);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  font-size: .92rem;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--edge);
}
.attachbtn:hover { background: var(--soft); }
.attachbtn:active { transform: translateY(2px); box-shadow: none; }
.hint { flex: 1 1 180px; font-size: .82rem; color: var(--muted); }

.filechip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 8px 8px 12px;
  background: var(--soft);
  border: 1.5px solid var(--pink-deep);
  border-radius: 12px;
  font-weight: 600;
  font-size: .92rem;
}
.filechip svg { flex: none; color: var(--accent); }
#filename { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filesize { flex: none; font-weight: 400; color: var(--muted); font-size: .84rem; }
.filechip button {
  flex: none;
  width: 30px; height: 30px;
  border: 0; border-radius: 50%;
  background: var(--pink);
  color: var(--ink);
  font-size: 19px; line-height: 1;
  cursor: pointer;
}

/* ---------- inside the box ---------- */
input[type="text"] {
  background: var(--field);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus {
  border-color: var(--pink-deep);
  box-shadow: 0 0 0 4px rgba(255, 185, 201, .4);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pink-deep) 40%, transparent);
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 18px 0 4px;
  font-size: .92rem;
  cursor: pointer;
}
.consent input {
  flex: none;
  width: 20px; height: 20px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.error {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--err-bg);
  color: var(--err-ink);
  font-size: .92rem;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 14px 18px;
  border: 2.5px solid var(--edge);
  border-radius: 16px;
  background: var(--pink);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--edge);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: var(--pink-deep); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn:disabled { opacity: .6; cursor: default; }
#after .btn { margin-top: 0; }
.btn.ghost {
  width: auto; margin: 0; flex: none;
  padding: 9px 15px;
  font-size: .95rem;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--edge);
}
.btn:focus-visible, .attachbtn:focus-visible, .filechip button:focus-visible, summary:focus-visible,
.consent input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- thanks (the receipt that comes back out of the slot) ---------- */
.thanks { text-align: center; outline: none; }
.thanks p { color: var(--muted); margin: 0 0 14px; font-size: .95rem; }
.receipt { display: flex; gap: 10px; align-items: center; }
.receipt code {
  flex: 1; min-width: 0;
  padding: 11px 12px;
  border: 1.5px dashed var(--pink-deep);
  border-radius: 14px;
  background: var(--soft);
  font: 600 .875rem/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: nowrap;
  overflow-x: auto;
  user-select: all;
}
.receipt input { flex: 1; min-width: 0; }

/* ---------- cloud + about ---------- */
.cloudwrap, .about { margin-top: 44px; }
.cloud { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cloud li {
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px var(--shadow-s);
}
.about p, .about li { color: var(--muted); margin: 0 0 12px; text-wrap: pretty; }
.about a { color: var(--accent); }
.delete { margin-top: 20px; }
.delete summary { cursor: pointer; font-weight: 600; color: var(--accent); width: fit-content; }
.delete form { margin-top: 14px; }
.note { margin: 10px 0 0; font-size: .92rem; color: var(--muted); }

@media (max-width: 480px) {
  :root { --inset: 16px; }
  main { padding-inline: 18px; }
  .tipbox { margin-inline: 6px; }
  .sheet { padding-inline: 14px; }
  .boxbody { padding-inline: 16px; }
  .row { grid-template-columns: 1fr; }
  .receipt { flex-wrap: wrap; justify-content: center; }
  .receipt code { flex-basis: 100%; }
}

/* ---------- download page (/indir) ---------- */
.brand a { color: inherit; text-decoration: none; }
.page .hero { padding-bottom: 8px; }
.page .about + .about { margin-top: 18px; }
.plain { margin: 0 0 12px; padding-left: 1.2em; }
.plain li { margin: 4px 0; }
.page pre {
  margin: 8px 0 12px;
  padding: 12px 14px;
  overflow-x: auto;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: 14px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.page code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.page .warn { padding: 10px 14px; border-radius: 12px; background: var(--warn-bg); border: 1px solid var(--pink); }
.page a { color: var(--accent); }

/* ---------- trash bridge card (computers only) ---------- */
.desk {
  margin: 28px 0 0;
  padding: 18px 18px 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 6px 22px var(--shadow-s);
}
.desk p { color: var(--muted); margin: 0 0 12px; }
.desk .btn { display: inline-block; text-decoration: none; text-align: center; }
.desk-copy { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; }
.desk-copy code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  padding: 10px 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: 13px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.desk-steps { margin: 14px 0 10px; padding-left: 1.3em; color: var(--muted); }
.desk-steps li { margin: 4px 0; }
.desk .note a { color: var(--accent); }

/* ---------- top bar: language and theme ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tools { display: flex; align-items: center; gap: 8px; }
.seg {
  display: inline-flex;
  padding: 2px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--chip);
}
.seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--pink); color: var(--ink); }
.seg button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- the box's face: an angel by day, a devil in the dark theme ---------- */
.face-devil { display: none; }
:root[data-theme="dark"] .face-angel { display: none; }
:root[data-theme="dark"] .face-devil { display: inline; }
:root[data-theme="dark"] .face { filter: drop-shadow(0 0 6px rgba(255, 74, 61, .55)); }
:root[data-theme="dark"] .face { animation: ember 2.6s ease-in-out infinite; }
@keyframes ember {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 74, 61, .45)); }
  50% { filter: drop-shadow(0 0 9px rgba(255, 154, 42, .8)); }
}

/* two horns grow from the lid; the sheet stays clear of them */
.lid::before, .lid::after { content: none; }
:root[data-theme="dark"] .lid::before,
:root[data-theme="dark"] .lid::after {
  content: "";
  position: absolute;
  top: -27px;
  width: 24px;
  height: 31px;
  background: linear-gradient(180deg, #ff4a3d 0%, #8f1010 70%);
}
:root[data-theme="dark"] .lid::before {
  left: 12px;
  clip-path: polygon(0 100%, 14% 46%, 58% 0, 66% 46%, 100% 100%);
}
:root[data-theme="dark"] .lid::after {
  right: 12px;
  clip-path: polygon(100% 100%, 86% 46%, 42% 0, 34% 46%, 0 100%);
}
@media (max-width: 480px) {
  :root[data-theme="dark"] .lid::before,
  :root[data-theme="dark"] .lid::after { width: 16px; height: 24px; top: -20px; }
  :root[data-theme="dark"] .lid::before { left: 6px; }
  :root[data-theme="dark"] .lid::after { right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  :root[data-theme="dark"] .face { animation: none; }
}
