:root {
  --space: #080819;
  --space-raised: #101024;
  --panel: rgba(18, 18, 42, .76);
  --panel-strong: rgba(23, 23, 53, .94);
  --line: rgba(174, 183, 255, .18);
  --line-bright: rgba(131, 243, 196, .52);
  --text: #f1f0ff;
  --muted: #a8a8c4;
  --accent: #83f3c4;
  --accent-dim: rgba(131, 243, 196, .13);
  --accent-glow: rgba(131, 243, 196, .22);
  --danger: #ff91af;
  --warning: #ffc77d;
  --soft-yellow: #ebe28a;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background: var(--space);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 65% 40% at 9% -8%, rgba(89, 79, 185, .22), transparent 70%),
    radial-gradient(ellipse 45% 34% at 97% 30%, rgba(32, 128, 133, .16), transparent 70%),
    var(--space);
}

body::before,
body::after {
  position: fixed;
  z-index: -2;
  width: 2px;
  height: 2px;
  border-radius: 1px;
  content: "";
  background: #e2edff;
  box-shadow:
    6vw 13vh #8deacb, 13vw 34vh #fff, 21vw 7vh #ad9eff,
    29vw 56vh #fff, 37vw 18vh #cdd5ff, 46vw 39vh #fff,
    54vw 8vh #8deacb, 63vw 69vh #fff, 71vw 23vh #c4b5ff,
    78vw 47vh #fff, 87vw 12vh #a3eee2, 94vw 63vh #fff,
    11vw 82vh #b6adff, 32vw 91vh #fff, 50vw 84vh #8deacb,
    81vw 88vh #d0d8ff;
}

body::before {
  top: 0;
  left: 0;
  opacity: .62;
  animation: star-drift 14s ease-in-out infinite alternate;
}

body::after {
  top: 24vh;
  left: 2vw;
  opacity: .34;
  transform: scale(.65);
  animation: star-drift-small 19s ease-in-out infinite alternate;
}

body > .app-shell::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: .24;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(203, 212, 255, .045) 3px 4px);
}

@keyframes star-drift {
  from { transform: translateY(0); opacity: .45; }
  to { transform: translateY(-17px); opacity: .85; }
}

@keyframes star-drift-small {
  from { transform: scale(.65) translateY(0); opacity: .22; }
  to { transform: scale(.65) translateY(-27px); opacity: .52; }
}

button, input { font: inherit; }
button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
.food-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.app-shell {
  width: min(100% - 32px, 960px);
  margin: 0 auto;
  padding: 22px 0 40px;
}

.archive-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  margin-bottom: 62px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.archive-logo,
.system-status,
.eyebrow,
.site-footer,
.status-label,
.lookup-message,
.nutrition-stat small {
  font-family: "DM Mono", monospace;
  letter-spacing: .045em;
}

.archive-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: .77rem;
  font-weight: 500;
}

.pixel-orbit {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-bright);
  color: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow), inset 0 0 10px var(--accent-dim);
  font-size: .72rem;
}

.logo-dot { color: var(--accent); }
.logo-path { color: var(--muted); }

.system-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: .63rem;
}

.system-status span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px var(--accent);
  animation: status-pulse 2.4s ease-in-out infinite;
}

@keyframes status-pulse {
  50% { opacity: .45; box-shadow: 0 0 3px var(--accent); }
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: .67rem;
  font-weight: 500;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 700px;
  margin-bottom: 9px;
  font-size: clamp(2.45rem, 7vw, 5rem);
  line-height: .93;
  letter-spacing: -.075em;
}

h1 em {
  color: var(--accent);
  font-style: normal;
  text-shadow: 0 0 24px var(--accent-glow);
}

h2 {
  font-size: 1.22rem;
  letter-spacing: -.035em;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.add-button,
.primary-button {
  position: relative;
  overflow: hidden;
  padding: 12px 17px;
  border: 1px solid var(--accent);
  border-radius: 7px 3px 7px 3px;
  color: #071612;
  background: var(--accent);
  box-shadow: 0 0 19px var(--accent-glow);
  font-weight: 700;
  transition: transform .25s ease, box-shadow .25s ease;
}

.add-button::after,
.primary-button::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 6px;
  content: "";
  background: var(--space);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.add-button:hover,
.primary-button:hover {
  box-shadow: 0 0 30px rgba(131, 243, 196, .4);
  transform: translateY(-2px);
}

.add-button { flex: 0 0 auto; white-space: nowrap; }
.add-button span { margin-right: 3px; font-size: 1.25rem; vertical-align: -1px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 44px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 8px 3px 8px 3px;
  background: var(--panel);
  box-shadow: inset 0 1px rgba(255, 255, 255, .035), 0 12px 32px rgba(0, 0, 0, .16);
  backdrop-filter: blur(12px);
}

.stat-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 26px;
  height: 2px;
  content: "";
  background: var(--accent);
}

.stat-card span {
  display: block;
  font-family: "DM Mono", monospace;
  font-size: 1.45rem;
  line-height: 1.2;
}

.stat-card small { color: var(--muted); font-family: "DM Mono", monospace; font-size: .7rem; }
.urgent span { color: var(--danger); }
.soon span { color: var(--warning); }
.all span { color: var(--accent); }
.urgent::before { background: var(--danger); }.soon::before { background: var(--warning); }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 { margin-bottom: 0; }

.text-button,
.small-action {
  padding: 4px;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-family: "DM Mono", monospace;
  font-size: .74rem;
  font-weight: 500;
}

.text-button { color: var(--danger); }
.text-button:hover, .small-action:hover { text-decoration: underline; }

.food-list { display: grid; gap: 9px; }

.food-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px 3px 8px 3px;
  background: var(--panel);
  box-shadow: inset 0 1px rgba(255,255,255,.04), 0 8px 24px rgba(0,0,0,.12);
  backdrop-filter: blur(12px);
  animation: card-in .35s ease both;
  transition: border-color .25s ease, transform .25s ease, background .25s ease;
}

.food-item:hover { border-color: rgba(131, 243, 196, .42); background: var(--panel-strong); transform: translateY(-1px); }

@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  color: var(--accent);
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.food-item.expired .status-dot { color: var(--danger); }
.food-item.today .status-dot, .food-item.soon .status-dot { color: var(--warning); }
.food-item.upcoming .status-dot { color: var(--soft-yellow); }

.item-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.food-name { margin: 0; font-size: 1rem; line-height: 1.25; }

.status-label {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--accent);
  background: var(--accent-dim);
  font-size: .64rem;
}

.expired .status-label { border-color: rgba(255,145,175,.35); color: var(--danger); background: rgba(255,145,175,.1); }
.today .status-label, .soon .status-label { border-color: rgba(255,199,125,.35); color: var(--warning); background: rgba(255,199,125,.1); }
.upcoming .status-label { border-color: rgba(235,226,138,.35); color: var(--soft-yellow); background: rgba(235,226,138,.09); }

.food-meta, .food-note { margin: 4px 0 0; color: var(--muted); font-size: .83rem; }
.food-note { font-style: italic; }

.item-actions { display: flex; align-items: center; gap: 11px; }

.quantity-control {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px 2px 5px 2px;
  background: rgba(5, 5, 19, .5);
}

.quantity-button {
  width: 31px;
  height: 30px;
  border: 0;
  color: var(--accent);
  background: rgba(157, 158, 225, .08);
  font-size: 1.15rem;
  line-height: 1;
}

.quantity-button:hover { background: var(--accent-dim); }
.quantity-value { width: 27px; font-family: "DM Mono", monospace; text-align: center; font-size: .8rem; }
.more-actions { display: flex; gap: 2px; }
.delete { color: var(--danger); }

.empty-state {
  padding: 58px 24px;
  border: 1px dashed rgba(131,243,196,.32);
  border-radius: 9px 3px 9px 3px;
  background: rgba(18,18,42,.52);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 13px;
  border: 1px solid var(--line-bright);
  border-radius: 3px;
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 20px var(--accent-glow);
  font-size: 1.2rem;
}

.empty-state h2 { margin-bottom: 7px; font-size: 1.22rem; }
.empty-state p { max-width: 350px; margin: 0 auto 19px; color: var(--muted); font-size: .92rem; }

.secondary-button {
  padding: 10px 13px;
  border: 1px solid var(--line-bright);
  border-radius: 6px 2px 6px 2px;
  color: var(--accent);
  background: rgba(131,243,196,.07);
  font-weight: 600;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}

.secondary-button:hover { background: var(--accent-dim); box-shadow: 0 0 16px var(--accent-glow); transform: translateY(-1px); }

.food-dialog {
  width: min(calc(100% - 28px), 490px);
  padding: 0;
  border: 1px solid rgba(131,243,196,.42);
  border-radius: 10px 3px 10px 3px;
  color: var(--text);
  background: #111127f5;
  box-shadow: 0 22px 70px rgba(0,0,0,.72), inset 0 1px rgba(255,255,255,.06);
}

.food-dialog::backdrop { background: rgba(3, 3, 13, .8); backdrop-filter: blur(7px); }
.food-dialog form, .scanner-content, .details-content { padding: 25px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 23px; }
.dialog-heading h2 { margin: 0; font-size: 1.42rem; }

.icon-button {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 4px 1px 4px 1px;
  color: var(--text);
  background: rgba(164,169,226,.08);
  font-size: 1.4rem;
  line-height: 1;
}

.icon-button:hover { border-color: var(--accent); color: var(--accent); }

label { display: block; margin-bottom: 15px; color: #d8d8ec; font-size: .83rem; font-weight: 600; }
.optional { color: var(--muted); font-weight: 400; }

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 5px 2px 5px 2px;
  outline: 0;
  color: var(--text);
  background: rgba(3,3,13,.6);
  font-weight: 500;
  color-scheme: dark;
}

input::placeholder { color: #777895; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim), 0 0 15px rgba(131,243,196,.08); }
.form-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 5px; }

.scan-button {
  display: block;
  width: 100%;
  margin: 0 0 18px;
  padding: 11px;
  border: 1px dashed var(--line-bright);
  border-radius: 6px 2px 6px 2px;
  color: var(--accent);
  background: var(--accent-dim);
  font-family: "DM Mono", monospace;
  font-size: .8rem;
  font-weight: 500;
  text-align: left;
}

.scan-button:hover { background: rgba(131,243,196,.2); box-shadow: 0 0 15px var(--accent-glow); }
.scan-button span { margin-right: 7px; font-size: 1.1rem; }
.lookup-message { margin: -7px 0 15px; color: var(--warning); font-size: .73rem; }

.camera-frame {
  position: relative;
  overflow: hidden;
  min-height: 196px;
  border: 1px solid var(--line-bright);
  border-radius: 7px 2px 7px 2px;
  background: #050510;
}

.camera-frame video { display: block; width: 100%; min-height: 196px; max-height: 300px; object-fit: cover; }

.scan-line {
  position: absolute;
  top: 50%;
  right: 13%;
  left: 13%;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 14px 3px var(--accent-glow);
  animation: scan 2.2s ease-in-out infinite;
}

@keyframes scan { 0%,100% { transform: translateY(-55px); opacity: .35; } 50% { transform: translateY(55px); opacity: 1; } }
.scanner-status { min-height: 1.25em; margin: 13px 0; color: var(--muted); font-size: .87rem; }
.barcode-form { display: flex; align-items: end; gap: 9px; }.barcode-form label { flex: 1; margin: 0; }.barcode-form .secondary-button { margin-bottom: 0; white-space: nowrap; }

.details-description { color: var(--muted); }
.nutrition-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 18px 0; }
.nutrition-stat { padding: 11px 12px; border: 1px solid var(--line); border-radius: 5px 2px 5px 2px; background: rgba(3,3,13,.5); }
.nutrition-stat small { display: block; margin-bottom: 3px; color: var(--muted); font-size: .65rem; }.nutrition-stat strong { color: var(--accent); font-family: "DM Mono", monospace; font-size: .9rem; }
.details-empty { color: var(--muted); }.details-source { margin: 18px 0 0; color: #777895; font-family: "DM Mono", monospace; font-size: .68rem; }
.food-item[tabindex="0"] { cursor: pointer; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 54px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: #777895;
  font-size: .65rem;
}

@media (max-width: 610px) {
  .app-shell { width: min(100% - 24px, 960px); padding-top: 16px; }
  .archive-bar { margin-bottom: 43px; }
  .logo-path { display: none; }
  .system-status { font-size: .56rem; }
  .hero { align-items: flex-start; }
  .add-button { padding: 10px 12px; }
  .add-button span { margin: 0; }
  .stats { margin-bottom: 31px; }
  .stat-card { padding: 13px 10px; }
  .stat-card span { font-size: 1.26rem; }
  .stat-card small { font-size: .61rem; }
  .food-item { grid-template-columns: 9px 1fr; align-items: start; gap: 12px; }
  .item-actions { grid-column: 2; justify-content: space-between; margin-top: 1px; }
  .food-dialog form, .scanner-content, .details-content { padding: 21px 18px; }
  .site-footer { flex-direction: column; margin-top: 40px; }
}

@media (max-width: 450px) {
  .barcode-form { flex-direction: column; align-items: stretch; }
  .barcode-form .secondary-button { width: 100%; }
}

@media (max-width: 370px) {
  .add-button { font-size: 0; }
  .add-button span { margin: 0; font-size: 1.35rem; }
  .more-actions { gap: 0; }
  .small-action { font-size: .71rem; }
}

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

/* Cosmic Archive holographic layer — aligned with the main Ikaruno.Space interface. */
.cosmic-haze {
  position: fixed;
  z-index: -3;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 16%, rgba(106, 79, 190, .14), transparent 30%),
    radial-gradient(circle at 16% 52%, rgba(73, 218, 193, .09), transparent 32%);
}

.scanlines {
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(170, 190, 255, .04) 4px);
}

.holo-field {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 78%, transparent);
}

.holo-line {
  position: absolute;
  left: -14vw;
  width: 66vw;
  height: 1px;
  opacity: .38;
  background: linear-gradient(90deg, transparent, var(--accent), rgba(201, 180, 255, .9), var(--accent), transparent);
  box-shadow: 0 0 11px var(--accent-glow), 0 0 28px rgba(150, 116, 255, .1);
  transform: rotate(-17deg);
}

.holo-line::after {
  position: absolute;
  top: 7px;
  right: 8%;
  width: 66%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(131, 243, 196, .55), transparent);
}

.holo-line-one { top: 24%; animation: holo-float-one 13s ease-in-out infinite alternate; }
.holo-line-two { top: 31%; width: 51vw; opacity: .25; animation: holo-float-two 17s ease-in-out infinite alternate; }
.holo-line-three { top: 68%; left: 55vw; width: 57vw; opacity: .2; transform: rotate(14deg); animation: holo-float-three 16s ease-in-out infinite alternate; }

@keyframes holo-float-one { to { transform: rotate(-17deg) translateX(9vw) translateY(-13px); opacity: .55; } }
@keyframes holo-float-two { to { transform: rotate(-17deg) translateX(14vw) translateY(15px); opacity: .4; } }
@keyframes holo-float-three { to { transform: rotate(14deg) translateX(-8vw) translateY(-16px); opacity: .34; } }

.holo-grid {
  position: absolute;
  left: 50%;
  bottom: -35%;
  width: min(1300px, 140vw);
  height: 560px;
  opacity: .46;
  background:
    linear-gradient(90deg, transparent 49.5%, rgba(131, 243, 196, .2) 50%, transparent 50.5%),
    linear-gradient(transparent 49.5%, rgba(150, 132, 255, .16) 50%, transparent 50.5%);
  background-size: 48px 48px;
  box-shadow: inset 0 100px 80px -80px rgba(131, 243, 196, .18);
  transform: translateX(-50%) perspective(340px) rotateX(62deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, #000, transparent 86%);
}

.archive-logo {
  font-family: "Press Start 2P", "DM Mono", monospace;
  font-size: .62rem;
  letter-spacing: .035em;
  text-shadow: 2px 2px 0 rgba(150, 116, 255, .7);
}

.archive-bar { border-bottom-color: rgba(131, 243, 196, .22); }

.hero { position: relative; }

.hero::before {
  position: absolute;
  z-index: -1;
  top: -52px;
  left: -4vw;
  width: min(590px, 75vw);
  height: 260px;
  content: "";
  opacity: .32;
  background: repeating-linear-gradient(-17deg, transparent 0 13px, rgba(131, 243, 196, .18) 14px 15px, transparent 16px 25px);
  mask-image: linear-gradient(90deg, #000, transparent 88%);
}

.stat-card,
.food-item,
.empty-state,
.food-dialog {
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 11px 100%, 0 calc(100% - 11px));
}

.stat-card::after,
.food-item::after {
  position: absolute;
  right: 13px;
  bottom: 8px;
  width: 36px;
  height: 1px;
  content: "";
  opacity: .62;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 6px);
}

.food-item { position: relative; }

.food-item::before {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 90px;
  content: "";
  opacity: 0;
  pointer-events: none;
  background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(131, 243, 196, .1) 7px 8px, transparent 9px 14px);
  transition: opacity .25s ease;
}

.food-item:hover::before { opacity: 1; }

.add-button,
.primary-button,
.secondary-button,
.quantity-control,
.icon-button,
.scan-button,
input,
.status-label { border-radius: 0; }

.add-button,
.primary-button,
.secondary-button,
.scan-button { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }

@media (max-width: 610px) {
  .holo-line-one { top: 18%; width: 98vw; }
  .holo-line-two { top: 27%; width: 80vw; }
  .holo-grid { bottom: -22%; width: 190vw; }
  .archive-logo { font-size: .54rem; }
}
