/* ===== Growtopia theme ===== */
:root {
  --sky: #6cc9ec;
  --sky-2: #a7e0f2;
  --purple: #7b4fb0;
  --purple-d: #5b3186;
  --green: #47b13e;
  --green-d: #2f8a2b;
  --yellow: #ffd84d;
  --yellow-d: #eab019;
  --brown: #8b5e3c;
  --cream: #fffdf3;
  --card: #e6f3fb;             /* light-blue surfaces */
  --field: #f2f9fd;           /* lighter light-blue for inputs/buttons */
  --ink: #33294f;
  --muted: #6c7590;
  --line: #cfe4f3;
  --accent: var(--green);      /* prices, success accents */
  --accent-ink: #06210f;
  --danger: #e5484d;
  --warn: #e6a817;
  --radius: 16px;
  --shadow: 0 6px 18px rgba(51, 41, 79, .12);
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--ink);
  font: 15px/1.55 "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--sky) 0%, var(--purple) 100%);
}
/* Fixed sky gradient behind everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-2) 32%, var(--purple) 100%);
}
/* Raining Diamond Locks */
#rain { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
#rain .drop {
  position: absolute; top: 0; will-change: transform;
  animation: fall linear infinite;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.15));
}
@keyframes fall {
  0%   { transform: translateY(-20vh) rotate(-8deg); }
  100% { transform: translateY(120vh) rotate(10deg); }
}
@media (prefers-reduced-motion: reduce) { #rain { display: none; } }
a { color: var(--purple-d); text-decoration: none; }
a:hover { text-decoration: underline; }

/* header / nav */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem 1.2rem; flex-wrap: wrap;
  background: rgba(224,243,251,.94); backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--yellow);
  box-shadow: 0 2px 12px rgba(51,41,79,.15);
}
.brand {
  font-weight: 800; font-size: 1.35rem; letter-spacing: .2px;
  /* Instagram gradient wordmark */
  background: linear-gradient(45deg, #feda75 0%, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.nav nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav nav a { color: var(--ink); font-weight: 600; }
.who { color: var(--muted); font-weight: 400; }
.who em { color: var(--green-d); font-style: normal; }

main { max-width: 980px; margin: 1.5rem auto; padding: 0 1rem; }
.foot {
  width: fit-content; max-width: min(980px, calc(100% - 2rem));
  margin: 2rem auto; padding: .8rem 1rem; font-size: .85rem;
  color: var(--ink); background: rgba(224,243,251,.85); border-radius: 12px;
  border: 1px solid var(--line);
}

h1 { font-size: 1.7rem; font-weight: 800; margin: .2rem 0 1rem;
     color: #fff; text-shadow: 0 2px 0 rgba(91,49,134,.55), 0 1px 3px rgba(0,0,0,.25); }
.panel h1, .card h1 { color: var(--ink); text-shadow: none; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 1.3rem 0 .6rem; color: var(--purple-d); }

.flashes { margin-bottom: 1rem; }
.flash { padding: .7rem 1rem; border-radius: 12px; margin-bottom: .5rem; font-weight: 600;
         border: 2px solid; box-shadow: var(--shadow); }
.flash.success { background: #e9fbe6; border-color: #8fd985; color: #226b1c; }
.flash.error { background: #fdeaea; border-color: #f2a6a8; color: #a2282c; }

/* cards / panels */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.card {
  background: var(--card); border: 2px solid var(--line);
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s;
}
a.card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(51,41,79,.20); text-decoration: none; }
.card .thumb { height: 120px; background: linear-gradient(160deg, var(--sky-2), #eafaff); display: grid; place-items: center; overflow: hidden; padding: 8px; }
.card .thumb img { max-width: 84px; max-height: 84px; width: auto; height: auto; object-fit: contain; }
.card .thumb .noimg { font-size: 2.4rem; }
.card .body { padding: .8rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card .name { font-weight: 700; color: var(--ink); }
.card .price { color: var(--green-d); font-weight: 800; }
.card .muted { color: var(--muted); font-size: .85rem; }

.panel {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem; margin-bottom: 1.2rem; box-shadow: var(--shadow);
}

/* forms */
label { display: block; margin: .7rem 0 .25rem; color: var(--muted); font-size: .9rem; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: .6rem .75rem; background: var(--field); color: var(--ink);
  border: 2px solid var(--line); border-radius: 10px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(108,201,236,.25); }
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* buttons */
.btn {
  display: inline-block; padding: .55rem 1.1rem; border-radius: 12px; border: 2px solid var(--line);
  background: var(--field); color: var(--ink); cursor: pointer; font: inherit; font-weight: 700;
}
.btn:hover { text-decoration: none; border-color: var(--purple); }
.btn.primary {
  background: var(--yellow); color: #5a3d00; border-color: var(--yellow-d);
  box-shadow: 0 3px 0 var(--yellow-d); font-weight: 800;
}
.btn.primary:hover { filter: brightness(1.03); transform: translateY(-1px); box-shadow: 0 4px 0 var(--yellow-d); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--yellow-d); }
.btn.danger { background: #fdeaea; border-color: #f2a6a8; color: #a2282c; box-shadow: none; }
.btn.small { padding: .32rem .7rem; font-size: .85rem; box-shadow: none; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--purple-d); font-weight: 700; font-size: .85rem; }

/* badges */
.badge { display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
         border: 2px solid; background: #eee9f7; border-color: #d7ccec; color: var(--purple-d); }
.badge.pending { background: #fff3d6; border-color: #f2d488; color: #8a6300; }
.badge.approved { background: #e9fbe6; border-color: #8fd985; color: #226b1c; }
.badge.rejected { background: #fdeaea; border-color: #f2a6a8; color: #a2282c; }
.badge.delivering { background: #e2f5fc; border-color: #94d6ec; color: #1d6d8a; }
.badge.delivered { background: #e9fbe6; border-color: var(--green); color: #226b1c; }
.badge.failed { background: #fdeaea; border-color: #f2a6a8; color: #a2282c; }

.worldname {
  font-family: ui-monospace, Menlo, monospace; font-size: 1.4rem; letter-spacing: .1em; font-weight: 700;
  background: #fff7d9; padding: .4rem .9rem; border-radius: 10px; display: inline-block;
  border: 2px dashed var(--yellow-d); color: var(--brown);
}
.hint { color: var(--muted); font-size: .85rem; }
.inline { display: inline-flex; gap: .4rem; align-items: center; }
.receipt-thumb { max-width: 120px; border-radius: 8px; border: 2px solid var(--line); }
.code-pill { font-family: ui-monospace, Menlo, monospace; background: #dcecf8; padding: .2rem .5rem; border-radius: 7px; border: 1px solid var(--line); color: var(--purple-d); }

/* payment-method picker cards */
.method-cards { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }
.method-card {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  min-width: 112px; padding: .65rem .7rem; cursor: pointer;
  background: var(--field); border: 2px solid var(--line); border-radius: 12px;
  transition: border-color .12s, background .12s, transform .1s;
}
.method-card:hover { border-color: var(--sky); transform: translateY(-2px); }
.method-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.method-card img { height: 30px; max-width: 92px; object-fit: contain; border-radius: 5px; }
.method-card .ml { font-size: .82rem; text-align: center; color: var(--ink); font-weight: 600; }
.method-card .mp { font-size: .82rem; font-weight: 800; color: var(--green-d); }
.method-card:has(input:checked) { border-color: var(--green); background: #eafbe6; box-shadow: 0 0 0 3px rgba(71,177,62,.18); }

.pay-instr {
  margin: .7rem 0; padding: .7rem .85rem;
  background: var(--field); border: 1px solid var(--line);
  border-inline-start: 4px solid var(--purple); border-radius: 10px;
}
.pay-instr strong { color: var(--purple-d); }
.pay-instr p { margin: .35rem 0 0; white-space: pre-wrap; word-break: break-word; }
.pay-instr a { color: var(--purple-d); text-decoration: underline; }

/* Overnight (Saudi 12am–7am) notice banner */
.night-note {
  margin: 0 0 1rem; padding: .7rem 1rem; border-radius: 12px;
  font-size: .9rem; font-weight: 600; line-height: 1.4;
  color: #f4ecff; background: linear-gradient(90deg, #2a1a4a, #3b2568);
  border: 1px solid #5b3186;
}

/* Fixed support-contact note, bottom-left of the home page */
.support-note {
  position: fixed; left: 14px; bottom: 14px; z-index: 5;
  max-width: min(80vw, 320px);
  padding: .55rem .8rem; font-size: .85rem; font-weight: 600;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 4px 14px rgba(51,41,79,.16);
}
.support-note a { color: var(--purple-d); font-weight: 800; white-space: nowrap; }
@media (max-width: 480px) { .support-note { font-size: .8rem; max-width: calc(100vw - 28px); } }

/* RTL (Arabic) tweaks */
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] .method-card .ml { text-align: center; }

/* ===== Time-of-day theme (sun / sunset / moon), set on <body class="tod-…"> ===== */
#sky {
  position: fixed; z-index: -2; top: 12vh; right: 3vw;
  width: 120px; height: 120px; pointer-events: none;
  image-rendering: pixelated;
}
@media (max-width: 560px) { #sky { width: 84px; height: 84px; top: 11vh; } }
/* the pixel disc (stair-stepped "low-res circle" silhouette) */
#sky::before {
  content: ""; position: absolute; inset: 0;
  clip-path: polygon(
    33% 0, 67% 0, 67% 8%, 83% 8%, 83% 17%, 92% 17%, 92% 33%, 100% 33%,
    100% 67%, 92% 67%, 92% 83%, 83% 83%, 83% 92%, 67% 92%, 67% 100%, 33% 100%,
    33% 92%, 17% 92%, 17% 83%, 8% 83%, 8% 67%, 0 67%, 0 33%, 8% 33%,
    8% 17%, 17% 17%, 17% 8%, 33% 8%);
}

/* Day — bright sun over the default bright sky */
body.tod-day #sky {
  color: #ffcf3a;
  filter: drop-shadow(0 0 16px rgba(255,220,90,.95)) drop-shadow(0 0 46px rgba(255,195,60,.7));
}
body.tod-day #sky::before {
  background: radial-gradient(circle at 50% 50%, #ffd84d 0%, #ffd84d 52%, #ffb31e 52%);
}

/* Sunset — low, redder sun over a warm orange sky */
body.tod-sunset #sky {
  top: 26vh; color: #ff8a3c;
  filter: drop-shadow(0 0 18px rgba(255,140,70,.9)) drop-shadow(0 0 54px rgba(255,95,45,.65));
}
body.tod-sunset #sky::before {
  background: radial-gradient(circle at 50% 50%, #ff9d3c 0%, #ff9d3c 52%, #ff6a2b 52%);
}
body.tod-sunset::before {
  background: linear-gradient(180deg, #ffb35a 0%, #ff8a5b 34%, #c2557f 72%, #5b3186 100%);
}

/* Night — moon over a dark sky, with a darkened palette */
body.tod-night #sky {
  color: #cdd8f2;
  filter: drop-shadow(0 0 16px rgba(210,224,255,.85)) drop-shadow(0 0 48px rgba(180,200,255,.55));
}
body.tod-night #sky::before {
  background: radial-gradient(circle at 50% 50%, #e2e8f6 0%, #e2e8f6 56%, #bcc6e2 56%);
}
body.tod-night::before {
  background: linear-gradient(180deg, #0e1230 0%, #191d43 42%, #281f4c 100%);
}
body.tod-night {
  --card: #211d3c;
  --field: #2a2550;
  --ink: #ecebf8;
  --muted: #a9adcc;
  --line: #3a3568;
  --purple-d: #c3aae8;   /* links + headings stay legible on dark */
  --green-d: #57c74e;    /* prices stay legible on dark */
  color-scheme: dark;
}
body.tod-night .nav  { background: rgba(24,20,46,.9); border-bottom-color: var(--purple); }
body.tod-night .foot { background: rgba(33,29,60,.85); }
body.tod-night .worldname { background: #3a3568; color: #ffedc2; }
body.tod-night .method-card:has(input:checked) { background: #1e3a1c; }
