/* =========================================================
   Tokenium — tasarım sistemi
   Gece (çivit) zemin, altın token vurgusu, Bricolage Grotesque
   ========================================================= */

@font-face {
  font-family: 'Bricolage';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  src: url(/assets/fonts/bricolage-grotesque-latin-standard-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: 'Bricolage';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  src: url(/assets/fonts/bricolage-grotesque-latin-ext-standard-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: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(/assets/fonts/jetbrains-mono-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: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(/assets/fonts/jetbrains-mono-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;
}

@property --spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

:root {
  color-scheme: dark;
  /* Discord tonları */
  --bg: #313338;          /* ana zemin */
  --surface: #2b2d31;     /* paneller, yan menü */
  --surface-2: #35373c;   /* üzerine gelme */
  --surface-3: #404249;   /* seçili */
  --deep: #1e1f22;        /* input, kod alanı, en koyu */
  --line: #3f4147;
  --line-strong: #4e5058;
  --text: #f2f3f5;
  --muted: #b5bac1;
  --faint: #949ba4;
  --accent: #5865f2;      /* blurple */
  --accent-hi: #4752c4;
  --accent-ink: #ffffff;
  --accent-soft: rgba(88, 101, 242, 0.16);
  --accent-chart: #6b77f5; /* grafik çubukları (doğrulandı: koyu zeminde L 0.48–0.70, kontrast ≥ 3:1) */
  --link: #00a8fc;
  --mint: #23a55a;
  --mint-soft: rgba(35, 165, 90, 0.16);
  --amber: #f0b232;
  --amber-soft: rgba(240, 178, 50, 0.14);
  --rose: #f23f43;
  --rose-soft: rgba(242, 63, 67, 0.14);
  --lilac: #949cf7;
  --lilac-soft: rgba(148, 156, 247, 0.14);
  /* tipografi */
  --sans: 'Bricolage', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  /* ölçüler */
  --r-sm: 4px;
  --r: 8px;
  --r-lg: 8px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --topbar: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 700; letter-spacing: -0.015em; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); }
[hidden] { display: none !important; }
button { font-family: inherit; }
.display { font-weight: 800; letter-spacing: -0.025em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
.text-danger { color: var(--rose) !important; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--r-sm); font-weight: 600; }
.skip-link:focus-visible { top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- Tk jetonu ---------- */
.coin {
  --size: 36px;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  padding: calc(var(--size) * 0.06);
  background: conic-gradient(from var(--spin), #3c45a5, #c9cdfb 14%, #5865f2 28%, #3c45a5 46%, #a5acf9 64%, #4752c4 82%, #3c45a5);
  animation: coin-rim 8s linear infinite;
}
.coin-face {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #aab2ff 0%, #6f7bf7 40%, #5865f2 62%, #3f49b8 100%);
  box-shadow: inset 0 calc(var(--size) * -0.05) calc(var(--size) * 0.1) rgba(20, 24, 80, 0.4);
  color: #ffffff;
  overflow: hidden;
}
.coin-face b { font: 800 calc(var(--size) * 0.4) / 1 var(--sans); letter-spacing: -0.04em; transform: translateY(6%); text-shadow: 0 calc(var(--size) * 0.02) 0 rgba(20, 24, 80, 0.35); }
.coin-face i { position: absolute; top: 16%; font: 600 calc(var(--size) * 0.13) / 1 var(--mono); font-style: normal; opacity: 0.7; }
.coin-face::after {
  content: '';
  position: absolute;
  inset: -30%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.35) 50%, transparent 58%);
  transform: translateX(-70%);
  animation: coin-shine 8s var(--ease) infinite;
}
@keyframes coin-rim { to { --spin: 360deg; } }
@keyframes coin-shine { 0%, 75% { transform: translateX(-70%); } 88%, 100% { transform: translateX(70%); } }

/* ---------- Üst bar (herkese açık sayfalar) ---------- */
.topbar {
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--bg);
  box-shadow: 0 1px 0 rgba(4, 4, 5, 0.2), 0 1.5px 0 rgba(6, 6, 7, 0.05), 0 2px 0 rgba(4, 4, 5, 0.05);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.brand-sub { color: var(--faint); font-weight: 500; margin-left: 5px; font-size: 15px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* ---------- Butonlar ve formlar ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r);
  border: 0;
  background: #4e5058;
  color: #ffffff;
  font: 550 14px/1 var(--sans);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.17s, color 0.17s, transform 0.12s var(--ease);
}
.btn:hover { background: #6d6f78; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hi); }
.btn-danger { background: var(--rose); color: #ffffff; }
.btn-danger:hover { background: #da373c; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn[aria-pressed='true'] { background: var(--accent-soft); color: #c9cdfb; }
.icon-btn { width: 38px; padding: 0; }
.icon-btn.btn-sm { width: 32px; }

.input, select.input, textarea.input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: var(--deep);
  color: var(--text);
  font: 15px var(--sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}
select.input { background-color: var(--deep); color: var(--text); }
textarea.input { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
textarea.mono { font-family: var(--mono); font-size: 13px; }
.input::placeholder { color: var(--faint); }
.input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.field { display: grid; gap: 7px; }
.field > label, .label { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.hint { font-size: 12.5px; color: var(--faint); }
.form-error { color: var(--rose); font-size: 13.5px; min-height: 1em; }
.check { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; cursor: pointer; }
.check input { appearance: none; margin: 0; width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid #80848e; background: var(--deep); cursor: pointer; transition: background-color 0.12s, border-color 0.12s; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked + svg { opacity: 1; }
.check svg { grid-area: 1 / 1; width: 12px; height: 12px; color: var(--accent-ink); opacity: 0; pointer-events: none; }
.check input { grid-area: 1 / 1; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; }
.chip-accent { border-color: transparent; background: var(--accent-soft); color: #c9cdfb; }
.chip-code { border-color: transparent; background: var(--deep); color: var(--text); font-family: var(--mono); font-weight: 600; letter-spacing: 0.06em; }
.chip-mint { border-color: transparent; background: var(--mint-soft); color: #4fd18b; }
.chip-amber { border-color: transparent; background: var(--amber-soft); color: var(--amber); }
.chip-lilac { border-color: transparent; background: var(--lilac-soft); color: #c9cdfb; }
.chip-rose { border-color: transparent; background: var(--rose-soft); color: #ff8e91; }
.chip-link { color: var(--text); text-decoration: none; height: 28px; transition: border-color 0.15s; }
.chip-link:hover { border-color: var(--link); color: var(--link); }

/* ---------- Platform rozeti ---------- */
.pbadge { --hue: var(--lilac); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; flex: none; background: color-mix(in srgb, var(--hue) 16%, transparent); color: var(--hue); border: 1px solid color-mix(in srgb, var(--hue) 35%, transparent); font-weight: 760; font-stretch: 80%; font-size: 18px; text-transform: capitalize; }
.pbadge-lg { width: 54px; height: 54px; font-size: 22px; border-radius: 16px; }

/* ---------- Gelen kutusu (alıcı + admin ortak) ---------- */
.app { min-height: 100%; height: 100%; display: flex; flex-direction: column; }
.inbox-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 370px minmax(0, 1fr); }
.pane { min-height: 0; display: flex; flex-direction: column; }
.pane-list { background: var(--surface); }
.pane-head { padding: 18px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.pane-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.address-card { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: var(--r); background: var(--deep); }
.address-text { font-family: var(--mono); font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.5); } 70% { box-shadow: 0 0 0 8px rgba(35, 165, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(35, 165, 90, 0); } }

.msg-list { list-style: none; margin: 0; padding: 8px; display: grid; gap: 2px; }
.msg-item {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 11px 13px 11px 18px;
  border-radius: var(--r-sm);
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s, border-color 0.15s;
}
.msg-item:hover { background: var(--surface-2); }
.msg-item.active { background: var(--surface-3); }
.msg-item.unread::before { content: ''; position: absolute; left: -8px; top: 14px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text); }
.msg-item.fresh { animation: fresh 1.6s var(--ease); }
@keyframes fresh { 0% { background: rgba(88, 101, 242, 0.3); transform: translateY(-6px); } 30% { transform: none; } 100% { background: transparent; } }
.msg-row { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.msg-from { font-weight: 650; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-item:not(.unread) .msg-from { font-weight: 520; }
.msg-time { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; flex: none; }
.msg-subject, .msg-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-snippet { color: var(--muted); font-size: 13.5px; }
.msg-tags { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }

.empty { padding: 52px 24px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.empty-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.empty-icon svg { width: 24px; height: 24px; }
.empty-title { font-weight: 680; font-size: 17px; }
.empty .muted { max-width: 320px; }

.viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: rise 0.28s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.viewer-head { padding: 20px 24px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.viewer-subject { font-size: 21px; line-height: 1.3; overflow-wrap: anywhere; }
.viewer-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; overflow-wrap: anywhere; }
.viewer-meta time { font-variant-numeric: tabular-nums; }
.viewer-highlights { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.code-box { display: inline-flex; align-items: center; gap: 14px; padding: 6px 6px 6px 16px; border-radius: var(--r); background: var(--deep); border-left: 4px solid var(--accent); }
.code-label { font-size: 12px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.code-value { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: 0.14em; color: var(--text); font-variant-numeric: tabular-nums; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.viewer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.viewer-frame { flex: 1; width: 100%; min-height: 320px; border: 0; background: #fff; }
.viewer-placeholder { flex: 1; display: grid; place-items: center; color: var(--faint); padding: 24px; text-align: center; }
.back-btn { display: none; justify-self: start; margin-left: -8px; }

/* ---------- Ortalanmış kart sayfaları ---------- */
.center { flex: 1; display: grid; place-items: center; padding: 40px 16px; }
.card { width: 100%; max-width: 480px; background: var(--bg); border-radius: var(--r); padding: 32px; display: grid; gap: 18px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
.card-wide { max-width: 580px; }
.card h1 { font-size: 26px; }

/* ---------- Dialog ---------- */
.dialog { border: 0; border-radius: var(--r); background: var(--bg); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45); color: var(--text); padding: 26px; width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overscroll-behavior: contain; }
.dialog-wide { width: min(720px, calc(100vw - 32px)); }
.dialog[open] { animation: pop 0.22s var(--ease); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
.dialog form, .dialog .dialog-body { display: grid; gap: 16px; }
.dialog-title { font-size: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translate(-50%, 18px); opacity: 0; pointer-events: none; background: var(--deep); color: var(--text); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); padding: 10px 18px; border-radius: 999px; font-weight: 650; font-size: 14px; transition: opacity 0.2s, transform 0.25s var(--ease); z-index: 80; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--rose); color: #ffffff; }

/* ---------- Ana sayfa ---------- */
.home { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); align-items: center; gap: 48px; max-width: 1080px; margin: 0 auto; padding: 48px 24px; width: 100%; }
.home h1 { font-size: clamp(36px, 5.5vw, 60px); line-height: 1.02; }
.home-copy { display: grid; gap: 22px; }
.home-copy > p { font-size: 17px; color: var(--muted); max-width: 46ch; }
.home-form { display: grid; gap: 8px; max-width: 520px; }
.home-form .row { display: flex; gap: 8px; }
.home-coin { display: grid; place-items: center; }
.home-coin .coin { --size: min(280px, 60vw); filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.35)); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .inbox-layout { grid-template-columns: 1fr; }
  .inbox-layout.show-detail .pane-list { display: none; }
  .inbox-layout:not(.show-detail) .pane-detail { display: none; }
  .back-btn { display: inline-flex; }
  .pane-list { border-right: 0; }
  .brand-sub { display: none; }
  .home { grid-template-columns: 1fr; gap: 28px; padding-top: 28px; }
  .home-coin { order: -1; }
  .home-coin .coin { --size: 150px; }
}

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