@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("cairo-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("cairo-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("cairo-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("cairo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("cairo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #e8d7ad;
  --surface: #fffaf3;
  --ink: #221c12;
  --muted: #6a5e49;
  --line: #eadcc4;
  --card: #ffffff;
  --green: #1c6b43;
  --green-ink: #ffffff;
  --gold: #9a7433;
  --notice-bg: #f8f1e2;
  --notice-ink: #6d4e22;
  --shadow: 0 18px 40px rgba(72, 52, 16, 0.12);
  --dock: rgba(255, 250, 243, 0.96);
  --page: radial-gradient(90% 55% at 100% -10%, #ffe7a8 0%, transparent 52%), radial-gradient(80% 50% at -10% 110%, #b7e7cf 0%, transparent 48%), linear-gradient(165deg, #f6e4bc 0%, #e7f4ea 52%, #d5eef4 100%);
  --shell: linear-gradient(180deg, #fffdf8 0%, #fff6e8 42%, #f3fbf6 100%);
  --bar: linear-gradient(100deg, rgba(255, 244, 214, 0.96), rgba(226, 245, 234, 0.96) 58%, rgba(214, 240, 245, 0.96));
  --action: linear-gradient(135deg, #2a9a62 0%, #0f6e56 55%, #14748f 100%);
  --panel: linear-gradient(160deg, #ffffff 0%, #fbf3e4 100%);
  --glow: radial-gradient(70% 45% at 100% 0%, rgba(226, 184, 92, 0.35), transparent 62%), radial-gradient(60% 40% at 0% 100%, rgba(0, 180, 205, 0.16), transparent 58%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12100c;
  --surface: #1c1812;
  --ink: #f6f0e4;
  --muted: #d2c4ac;
  --line: #3c3428;
  --card: #262017;
  --green: #8fd0a8;
  --green-ink: #102117;
  --gold: #e4c27a;
  --notice-bg: #3a2e1c;
  --notice-ink: #f3e2c4;
  --shadow: none;
  --dock: rgba(28, 24, 18, 0.96);
  --page: radial-gradient(80% 50% at 100% 0%, rgba(196, 146, 58, 0.38), transparent 50%), radial-gradient(70% 45% at 0% 100%, rgba(24, 122, 96, 0.32), transparent 48%), linear-gradient(165deg, #1a140e 0%, #121816 54%, #10191d 100%);
  --shell: linear-gradient(180deg, #2a2318 0%, #1b1914 58%, #14211c 100%);
  --bar: linear-gradient(100deg, rgba(54, 40, 22, 0.96), rgba(24, 48, 40, 0.96) 60%, rgba(18, 42, 52, 0.96));
  --action: linear-gradient(135deg, #8d6b2e 0%, #1d7a52 50%, #146e86 100%);
  --panel: linear-gradient(160deg, #322a20 0%, #1c2823 100%);
  --glow: radial-gradient(70% 45% at 100% 0%, rgba(212, 168, 82, 0.2), transparent 62%), radial-gradient(60% 40% at 0% 100%, rgba(0, 180, 205, 0.14), transparent 58%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #12100c;
    --surface: #1c1812;
    --ink: #f6f0e4;
    --muted: #d2c4ac;
    --line: #3c3428;
    --card: #262017;
    --green: #8fd0a8;
    --green-ink: #102117;
    --gold: #e4c27a;
    --notice-bg: #3a2e1c;
    --notice-ink: #f3e2c4;
    --shadow: none;
    --dock: rgba(28, 24, 18, 0.96);
    --page: radial-gradient(80% 50% at 100% 0%, rgba(196, 146, 58, 0.38), transparent 50%), radial-gradient(70% 45% at 0% 100%, rgba(24, 122, 96, 0.32), transparent 48%), linear-gradient(165deg, #1a140e 0%, #121816 54%, #10191d 100%);
    --shell: linear-gradient(180deg, #2a2318 0%, #1b1914 58%, #14211c 100%);
    --bar: linear-gradient(100deg, rgba(54, 40, 22, 0.96), rgba(24, 48, 40, 0.96) 60%, rgba(18, 42, 52, 0.96));
    --action: linear-gradient(135deg, #8d6b2e 0%, #1d7a52 50%, #146e86 100%);
    --panel: linear-gradient(160deg, #322a20 0%, #1c2823 100%);
    --glow: radial-gradient(70% 45% at 100% 0%, rgba(212, 168, 82, 0.2), transparent 62%), radial-gradient(60% 40% at 0% 100%, rgba(0, 180, 205, 0.14), transparent 58%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: flex;
  justify-content: center;
  color: var(--ink);
  background: var(--page);
  font-family: "Cairo", Tahoma, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

.shell {
  display: flex;
  flex-direction: column;
  width: min(100%, 32rem);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--shell);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: calc(0.75rem + env(safe-area-inset-top)) 0.9rem 0.75rem;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}

.seal {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  background: #c6a15a;
}

.brand {
  flex: 1;
  min-width: 0;
}

.brand p {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
}

.icon-btn,
.tab,
.fb,
.fb-link,
button {
  touch-action: manipulation;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn .sun {
  display: none;
}

[data-theme="dark"] .icon-btn .moon {
  display: none;
}

[data-theme="dark"] .icon-btn .sun {
  display: block;
}

.screen {
  flex: 1;
  padding: 1.15rem 1rem 1.25rem;
  background: var(--glow);
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  line-height: 1.35;
}

h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.lead,
.panel p,
.panel li {
  color: var(--muted);
}

.lead {
  margin: 0 0 1rem;
}

.panel {
  margin-top: 0.85rem;
  padding: 0.9rem 0.95rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.panel ol {
  margin: 0;
  padding-inline-start: 1.2rem;
}

.notice {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  color: var(--notice-ink);
  background: linear-gradient(100deg, var(--notice-bg), rgba(255, 255, 255, 0.28));
  border-radius: 12px;
}

label {
  display: block;
  margin: 0.85rem 0 0.35rem;
  font-weight: 700;
}

input,
select,
button {
  width: 100%;
  font: inherit;
}

input,
select {
  padding: 0.75rem 0.8rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

button[type="submit"] {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  color: #fff;
  background: var(--action);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(15, 110, 86, 0.22);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
.tab:focus-visible,
.fb:focus-visible,
.fb-link:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.result {
  margin-top: 1.15rem;
  padding: 0.35rem 0.85rem 0.5rem;
  border: 2px solid transparent;
  border-radius: 18px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, #e2c27a, #1c8a5a 48%, #00b4cd) border-box;
}

table {
  width: 100%;
  margin-top: 0.2rem;
  border-collapse: collapse;
}

caption {
  margin-bottom: 0.45rem;
  font-weight: 700;
  text-align: start;
}

th,
td {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
}

th {
  width: 46%;
  color: var(--muted);
}

.hero-seal {
  display: block;
  width: 168px;
  height: 168px;
  margin: 0.4rem auto 0.8rem;
  border-radius: 50%;
  object-fit: cover;
  background: #c6a15a;
}

.hero-logo {
  display: block;
  width: min(220px, 70%);
  height: auto;
  margin: 0.8rem auto;
}

.fb-link,
.fb {
  color: #fff;
  background: #1877f2;
  text-decoration: none;
}

.fb-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
}

.fb-link svg,
.fb svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.dock {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--bar);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.credit {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem 0.15rem;
}

.credit img {
  width: 78px;
  height: auto;
  flex: 0 0 auto;
}

.credit span {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35;
}

.fb {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 64px;
  padding: 0.4rem 0.15rem 0.5rem;
  color: var(--muted);
  text-decoration: none;
  text-align: center;
}

.tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab span {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
}

.tab.is-current {
  color: var(--gold);
  background: linear-gradient(180deg, transparent, rgba(226, 194, 122, 0.28));
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(18, 16, 12, 0.45);
}

.loading[hidden] {
  display: none;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  min-width: 11rem;
  padding: 1.2rem 1.3rem;
  color: var(--ink);
  background: var(--surface);
  border-radius: 18px;
}

.loading-card p {
  margin: 0;
  font-weight: 700;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 840px) {
  .seal {
    width: 72px;
    height: 72px;
  }

  .brand p {
    font-size: 1.15rem;
  }

  .screen {
    padding: 1.5rem 1.3rem 1.6rem;
  }
}

@media (max-width: 360px) {
  .credit span,
  .fb span {
    font-size: 0.68rem;
  }

  .tab span {
    font-size: 0.62rem;
  }
}
