:root {
  --bg: #0b1118;
  --bg-soft: #121b26;
  --card: #182433;
  --text: #eef3f8;
  --muted: #b9c6d4;
  --primary: #1f8fff;
  --primary-press: #1773cf;
  --danger: #ff6d6d;
  --success: #43d69c;
  --warning: #ffcf69;
  --ring: #7db7ff;
  --border: #2a3b4f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Segoe UI", "Noto Sans", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -20%, #203047 0%, transparent 36%),
    radial-gradient(circle at 90% 0%, #172537 0%, transparent 28%),
    var(--bg);
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 0.9rem max(2rem, env(safe-area-inset-bottom));
}

.app-header {
  text-align: center;
  margin-bottom: 0.55rem;
}

.logo {
  max-width: 220px;
  width: 100%;
  height: auto;
  margin-bottom: 0.6rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2.6vw, 1.45rem);
  letter-spacing: 0.06em;
}

.card {
  background: linear-gradient(180deg, #1a2737 0%, #162230 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
}

.field-label,
.counter,
.message {
  font-size: 0.95rem;
}

input[type="text"] {
  width: 100%;
  border: 1px solid #3a5169;
  background: #0f1925;
  color: var(--text);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
}

input[type="text"]:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.top-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.photos-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.photos-top-row .counter {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background-color 140ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:not(:disabled):hover {
  background: var(--primary-press);
}

.btn-secondary {
  background: #23364a;
  border: 1px solid #35516d;
  color: #f2f7ff;
}

.quick-actions .btn,
.photos-top-row .btn {
  width: auto;
  min-height: 42px;
  min-width: 150px;
  font-size: 0.88rem;
  padding: 0.5rem 0.65rem;
  border-radius: 4px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  fill: currentColor;
  flex: 0 0 auto;
}

.quick-actions .btn-ghost {
  margin-top: 0;
}

.btn-ghost {
  background: transparent;
  color: #d7e5f5;
  border: 1px solid #476684;
  margin-top: 0.5rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.thumb {
  position: relative;
  border: 1px solid #35506a;
  border-radius: 12px;
  overflow: hidden;
  background: #0f1925;
  aspect-ratio: 1 / 1;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.delete-photo {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(9, 15, 22, 0.82);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.message {
  min-height: 1.35rem;
  margin: 0.55rem 0 0;
}

#photoLimitMsg:empty,
#photoError:empty {
  display: none;
}

.error {
  color: var(--danger);
}

.warning {
  color: var(--warning);
}

.status {
  color: #d8e6f5;
}

.status.success {
  color: var(--success);
  text-align: center;
  font-weight: 700;
  font-size: 1.15rem;
}

.status-success-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.status-check-icon {
  width: 40px;
  height: 40px;
  fill: currentColor;
  flex: 0 0 auto;
}

.status.error {
  color: var(--danger);
}

@media (min-width: 700px) {
  .app-shell {
    padding-top: 1.5rem;
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
