*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink-muted) 42%, transparent) transparent;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink-secondary);
  background-color: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dd, figure {
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.24;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: var(--accent-hover);
}

img, svg {
  display: block;
  max-width: 100%;
}

/* Keep Turkish & regional flag emojis crisp on Windows and all OSes */
img.emoji-flag {
  display: inline-block;
  width: 1.38em;
  height: 0.92em;
  max-width: none;
  margin: 0 0.1em;
  padding: 0;
  vertical-align: -0.13em;
  object-fit: cover;
  border: 0;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

code, pre, .mono {
  font-family: var(--font-mono);
}

.tabular,
.num-tabular {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: 0;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 2000;
  padding: 10px 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  top: 12px;
  color: #ffffff;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(17, 11, 30, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--ink-muted) !important; }
.text-ink { color: var(--ink) !important; }
.text-secondary-ink { color: var(--ink-secondary) !important; }
.text-accent { color: var(--accent) !important; }
.text-discord { color: #5865F2 !important; }

/* Strict-CSP Layout, Flex, Spacing & Typography Utilities */
.stack-xs,
.stack-sm,
.stack-md,
.stack-lg {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
}

.stack-xs { gap: 6px; }
.stack-sm { gap: 12px; }
.stack-md { gap: 18px; }
.stack-lg { gap: 26px; }

.row-gap-xs {
  display: flex;
  align-items: safe center;
  gap: 6px;
  flex-wrap: wrap;
}

.row-gap {
  display: flex;
  align-items: safe center;
  gap: 10px;
  flex-wrap: wrap;
}

.row-gap-md {
  display: flex;
  align-items: safe center;
  gap: 14px;
  flex-wrap: wrap;
}

.row-between {
  display: flex;
  align-items: safe center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.row-end,
.form-actions {
  display: flex;
  align-items: safe center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.form-actions {
  padding-top: 4px;
}

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.self-start { align-self: flex-start; }
.self-end { align-self: flex-end; }
.self-center { align-self: center; }
.flex-1 { flex: 1 1 180px; min-inline-size: 0; }
.shrink-0 { flex-shrink: 0; }
.ms-auto { margin-inline-start: auto; }
.w-full { width: 100%; }
.span-full { grid-column: 1 / -1; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.uppercase-input { text-transform: uppercase; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-sm { font-size: 0.86rem; line-height: 1.55; }
.text-xs { font-size: 0.78rem; line-height: 1.45; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 10px; }
.mt-md { margin-top: 18px; }
.mb-xs { margin-bottom: 6px; }
.mb-sm { margin-bottom: 12px; }
.mb-md { margin-bottom: 18px; }
.m-0 { margin: 0 !important; }

@media (max-width: 640px) {
  .hide-sm {
    display: none !important;
  }
}
