/* Craden store: RewindBox-style layout (banner, left sidebar, white cards) in Craden red. */
:root {
  --red: #c62835;
  --red-dark: #8b101c;
  --red-deep: #5a0a13;
  --bg: #efefef;
  --card: #ffffff;
  --line: #e4e4e4;
  --text: #2b2b2b;
  --muted: #7a7a7a;
  --foot: #c4c4c4;
  --radius: 4px;
  --shadow: 0 2px 6px rgba(0, 0, 0, .06);
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 500 15px/1.55 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Banner */
.banner {
  height: 300px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.07) 0 2px, transparent 2px 18px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.07) 0 2px, transparent 2px 18px),
    radial-gradient(80% 140% at 50% 0%, var(--red), var(--red-dark) 62%, var(--red-deep));
  display: flex; justify-content: center; align-items: flex-start; padding-top: 28px;
}
.banner-logo img { width: 190px; height: 190px; object-fit: contain; display: block; filter: drop-shadow(0 10px 18px rgba(0,0,0,.45)); transition: transform .2s; }
.banner-logo:hover img { transform: scale(1.04) rotate(-2deg); }

/* Layout */
.page {
  flex: 1; width: 100%; max-width: 1170px; margin: -64px auto 0; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-columns: 265px minmax(0, 1fr); gap: 30px; align-items: start; position: relative;
}
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.side { display: grid; gap: 12px; }
.main { display: grid; gap: 16px; min-width: 0; outline: none; }

/* Logged in as */
.who { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.who img { border-radius: 3px; image-rendering: pixelated; flex: none; background: var(--line); }
.who-text { flex: 1; min-width: 0; }
.who small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.who b { display: block; font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { border: 0; background: none; color: var(--red); padding: 6px; border-radius: var(--radius); }
.icon-btn:hover { background: #fbe9eb; }

/* Nav */
#nav { display: grid; gap: 12px; }
.nav-item { display: block; padding: 18px 18px; font-weight: 700; text-decoration: none; border-left: 4px solid transparent; }
.nav-item:hover { color: var(--red); }
.nav-item.active { border-left-color: var(--red); color: var(--red); }
.nav-group { overflow: hidden; }
.nav-group > button { width: 100%; text-align: left; background: none; border: 0; border-left: 4px solid transparent; padding: 18px; font-weight: 700; color: var(--text); }
.nav-group > button::after { content: ""; display: inline-block; margin-left: 6px; border: 5px solid transparent; border-top-color: currentColor; transform: translateY(3px); }
.nav-group.open > button { background: #ececec; border-left-color: var(--red); }
.nav-group.open > button::after { transform: translateY(-2px) rotate(180deg); }
.nav-group ul { list-style: none; margin: 0; padding: 8px 0 10px; border-left: 4px solid var(--red); display: none; }
.nav-group.open ul { display: block; }
.nav-group li a { display: block; padding: 5px 24px; text-decoration: none; font-weight: 500; }
.nav-group li a:hover, .nav-group li a.active { color: var(--red); }

/* Basket */
.basket { padding: 14px 16px; display: grid; gap: 10px; }
.basket-head { display: flex; justify-content: space-between; align-items: center; }
.basket-head span { background: var(--red); color: #fff; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.basket ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.basket li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.basket li span { flex: 1; min-width: 0; }
.basket li b { font-weight: 600; }
.basket li button { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 2px; }
.basket li button:hover { color: var(--red); }
.basket-total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; }

/* Buttons */
.btn { border: 0; border-radius: var(--radius); background: var(--red); color: #fff; font-weight: 700; padding: 9px 18px; }
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: #fff; color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.btn-ghost:hover { background: #fbe9eb; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 22px; font-size: 14px; }

/* Main content */
.welcome { padding: 28px 30px; }
.welcome p { margin: 0 0 14px; }
.welcome p:last-child { margin-bottom: 0; }
.welcome b { font-weight: 700; }
.welcome a { color: #2f6fd6; text-decoration: none; }
.welcome a:hover { text-decoration: underline; }
.welcome .head { text-transform: uppercase; }
.loading { padding: 28px 30px; color: var(--muted); }

.cat-note { background: #d9d9d9; color: #fff; padding: 12px 16px; border-radius: var(--radius); display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cat-note i { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.9); color: #b5b5b5; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 14px; flex: none; }
.cat { padding: 6px 16px 10px; }
.cat h1 { font-size: 20px; margin: 10px 0 4px; }
.cat-desc { color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 24px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-name { font-size: 14px; }
.row-price { font-size: 14px; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.row-price s { color: var(--red); margin-right: 4px; }
.row-price small { font-size: 11px; margin-left: 2px; }
.empty { padding: 20px 4px; color: var(--muted); }

/* Footer */
.foot { background: var(--foot); }
.foot-inner { max-width: 1170px; margin: 0 auto; padding: 30px max(16px, env(safe-area-inset-right, 0px)) 30px max(16px, env(safe-area-inset-left, 0px)); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; font-weight: 700; color: #6c6c6c; }
.foot-tebex { font-weight: 500; max-width: 520px; }

.foot-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.foot-links a { color: #555; font-weight: 700; text-decoration: none; }
.foot-links a:hover { color: var(--red); text-decoration: underline; }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(20, 10, 12, .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-box { position: relative; background: #fff; border-radius: 6px; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 26px 28px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.3); display: grid; gap: 14px; }
.modal-small { width: min(420px, 100%); }
.modal-box h2 { margin: 0; font-size: 22px; padding-right: 30px; }
.modal-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--muted); padding: 4px 8px; }
.modal-x:hover { color: var(--red); }
.pkg-desc { font-size: 14px; color: #444; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; }
.pkg-desc p { margin: 0 0 8px; }
.pkg-desc p:last-child { margin: 0; }
.pkg-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pkg-price { font-size: 22px; font-weight: 800; }
.pkg-price s { color: var(--red); font-size: 15px; margin-right: 6px; font-weight: 600; }
.pkg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-msg { margin: 0; font-size: 13px; color: var(--red); min-height: 1em; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }
.modal input { width: 100%; border: 1px solid #ccc; border-radius: var(--radius); padding: 11px 12px; font: 600 15px var(--font); }
.modal input:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px #fbe9eb; }
code { background: #f2f2f2; padding: 1px 5px; border-radius: 3px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); opacity: 0; background: #222; color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 14px; font-weight: 600; transition: .2s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .banner { height: 230px; }
  .banner-logo img { width: 150px; height: 150px; }
  .page { grid-template-columns: 1fr; margin-top: -40px; gap: 16px; }
  .row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .row .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { .banner-logo img, .toast { transition: none; } }
