:root {
  --bg: #0A0C18;
  --bg-panel: #0D0F1E;
  --tile: #131730;
  --tile-border: #262B4A;
  --tile-border-soft: #1D2140;
  --teal: #35D6A6;
  --teal-dim: #12261F;
  --amber: #F2A93B;
  --amber-deep: #C9841F;
  --amber-ink: #16130A;
  --text: #F5F6FB;
  --text-muted: #A6ACC9;
  --text-faint: #6B7093;
  --send-bg: #B9BEDB;
  --send-ink: #12142A;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 2rem 1rem 3rem;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

button {
  font-family: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

.meta-note {
  max-width: 420px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 1.1rem;
  line-height: 1.5;
}

.meta-note strong {
  color: var(--text-muted);
  font-weight: 500;
}

.phone {
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  background: var(--bg-panel);
  border-radius: 34px;
  border: 1px solid #14172c;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.statusbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.3rem 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.statusbar .right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.battery {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--tile);
  border: 1px solid var(--tile-border);
  border-radius: 5px;
  padding: 0.05rem 0.35rem;
  font-size: 0.72rem;
  color: var(--text);
}

.screen {
  padding: 0.4rem 1.15rem 1.4rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--tile-border) transparent;
}

.screen::-webkit-scrollbar {
  width: 7px;
}

.screen::-webkit-scrollbar-track {
  background: transparent;
}

.screen::-webkit-scrollbar-thumb {
  background: var(--tile-border);
  border-radius: 10px;
}

.screen::-webkit-scrollbar-thumb:hover {
  background: #3a4070;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.1rem 0.9rem;
  border-bottom: 1px solid var(--tile-border-soft);
  margin-bottom: 0.9rem;
}

.app-title .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

.app-title h1 {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.55rem;
  margin: 0;
  letter-spacing: -0.01em;
}

.counter-box {
  background: var(--tile);
  border: 1px solid var(--tile-border);
  border-radius: 12px;
  padding: 0.7rem 0.95rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

.counter-box strong {
  color: var(--text);
}

.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0.15rem 0.55rem;
}

.section-label .edit {
  color: var(--teal);
  text-decoration: underline;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.78rem;
  background: none;
  border: none;
  padding: 0;
}

.project-tabs {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  margin-bottom: 0.9rem;
  scrollbar-width: none;
}

.project-tabs::-webkit-scrollbar {
  display: none;
}

.ptab {
  flex-shrink: 0;
  background: var(--tile);
  border: 1px solid var(--tile-border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}

.ptab.active {
  border-color: var(--teal);
  color: var(--teal);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 1.1rem;
}

.tile {
  background: var(--tile);
  border: 1px solid var(--tile-border);
  border-radius: 16px;
  padding: 1.05rem 0.6rem;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.25;
  transition: border-color .15s, color .15s, background .15s;
  position: relative;
}

.tile:hover {
  border-color: #3a4070;
}

.tile.selected {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-dim);
}

.tile.quick {
  border-color: var(--amber-deep);
  color: var(--amber);
}

.tile.quick.selected {
  border-color: var(--amber);
  background: #241a0c;
  color: var(--amber);
}

.tile .badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  color: var(--teal);
  opacity: 0;
}

.tile .badge.show {
  opacity: 1;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.btn-capture {
  background: var(--amber);
  color: var(--amber-ink);
  border: none;
  border-radius: 16px;
  padding: 1.15rem 0.6rem;
  font-weight: 700;
  font-size: 1.02rem;
  transition: filter .15s, transform .1s;
}

.btn-capture:hover {
  filter: brightness(1.05);
}

.btn-capture:active {
  transform: scale(0.98);
}

.btn-gallery {
  background: var(--tile);
  border: 1px solid var(--tile-border);
  color: var(--text-muted);
  border-radius: 16px;
  padding: 1.15rem 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.btn-gallery:hover {
  border-color: #3a4070;
  color: var(--text);
}

.btn-gallery.active-flash,
.btn-capture.active-flash {
  animation: flashcap .5s ease;
}

@keyframes flashcap {
  0% {
    box-shadow: 0 0 0 0 rgba(242, 169, 59, 0.5);
  }

  100% {
    box-shadow: 0 0 0 10px rgba(242, 169, 59, 0);
  }
}

.photo-area {
  margin-bottom: 1.2rem;
}

.photo-hint {
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: center;
  padding: 0.4rem 0.2rem 0.1rem;
}

.photo-single {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--teal);
  overflow: hidden;
  aspect-ratio: 16/10;
  display: flex;
  align-items: flex-end;
}

.photo-single .fname {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  margin: 0.55rem;
}

.photo-single .remove-photo {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(10, 12, 24, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-single .remove-photo:hover {
  background: rgba(10, 12, 24, 0.95);
}

.photo-single .from-badge {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--teal);
  background: rgba(10, 20, 17, 0.75);
  border: 1px solid #1f5a45;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

.gallery-panel {
  background: var(--tile);
  border: 1px solid var(--tile-border);
  border-radius: 16px;
  padding: 0.8rem;
}

.gallery-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.gallery-panel-head span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-faint);
  letter-spacing: 0.06em;
}

.gallery-panel-head button {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 0.78rem;
  text-decoration: underline;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.gallery-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--tile-border);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  transition: border-color .15s, transform .1s;
}

.gallery-thumb:hover {
  border-color: var(--amber);
  transform: scale(1.02);
}

.gallery-thumb .fname {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  margin: 0.3rem;
}

.size-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.size-btn {
  background: var(--tile);
  border: 1px solid var(--tile-border);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 0.65rem 0.4rem;
  font-weight: 600;
  font-size: 0.88rem;
}

.size-btn.selected {
  border-color: var(--amber);
  color: var(--amber);
}

.btn-send {
  width: 100%;
  background: var(--send-bg);
  color: var(--send-ink);
  border: none;
  border-radius: 14px;
  padding: 1rem;
  font-weight: 700;
  font-size: 1.02rem;
  margin-bottom: 0.9rem;
  transition: filter .15s, transform .1s, opacity .15s;
}

.btn-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-send:not(:disabled):hover {
  filter: brightness(1.05);
}

.btn-send:not(:disabled):active {
  transform: scale(0.99);
}

.confirm-banner {
  background: var(--teal-dim);
  border: 1px solid #1f5a45;
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity .3s, max-height .3s;
}

.confirm-banner.show {
  opacity: 1;
  max-height: 60px;
  margin-bottom: 0.4rem;
}

.confirm-banner .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
}

.below-note {
  max-width: 420px;
  text-align: center;
  margin-top: 1.2rem;
}

.reset-link {
  background: none;
  border: 1px solid var(--tile-border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
}

.reset-link:hover {
  border-color: var(--text-muted);
  color: var(--text);
}