  .login-box {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .input-wrap input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1.5px solid var(--white);
    border-radius: var(--radius);
    color: var(--white);
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
  }
  .input-wrap input:focus { border-color: var(--accent); }

  .login-error {
    color: #e07a6a;
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.2em;
  }

  #app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }

  header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: calc(var(--safe-top) + 0.75rem) 1rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    color: var(--muted);
    font: inherit;
    transition: color 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  .icon-btn:hover { color: var(--text); border-color: var(--accent); }
  .icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .count-badge {
    font-size: 0.8rem;
    color: var(--muted);
    padding: 0 0.25rem;
  }

  #upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.53);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.3s;
  }

  #upload-zone.dragover { border-color: var(--accent); }

  .upload-inner {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
  }

  .upload-icon {
    width: 52px;
    height: 52px;
    background: rgba(212,169,106,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
  }

  .upload-label {
    font-size: 0.95rem;
    color: var(--muted);
    line-height: 1.5;
  }

  .upload-label strong { color: var(--text); display: block; font-size: 1rem; margin-bottom: 0.25rem; }

  .progress-bar {
    position: absolute;
    bottom: 0; left: 0;
    height: 100%;
    width: 0%;
    background: rgba(0, 0, 0, 0.2);
    transition: width 0.15s linear;
    z-index: 1;
  }
  .progress-bar.indeterminate {
    width: 30% !important;
    animation: indeterminate 1.2s infinite;
    background: var(--accent2);
  }
  .progress-bar.done  { width: 100% !important; }
  .progress-bar.error { background: #e07a6a; }

  @keyframes indeterminate {
    0%   { left: -30%; }
    100% { left: 100%; }
  }

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

  .progress-status.done    { color: rgb(77, 188, 3); }
  .progress-status.error   { color: var(--main); }
  .progress-status.pending { opacity: 0.5; }

  .progress-cancel:hover        { color: #e07a6a; border-color: #e07a6a; }
  .progress-cancel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .progress-cancel:disabled     { opacity: 0.25; cursor: default; pointer-events: none; }

  .progress-bar-wrap {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: var(--border);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
  }

  #gallery {
    flex: 1;
  }

  .gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .125rem;
  }

  @media (min-width: 600px) {
    .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  }

  @media (min-width: 900px) {
    .gallery-grid { grid-template-columns: repeat(4, 1fr); }
  }

  .thumb-wrap {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--white);
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
  }

  .thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
  }

  .thumb-wrap:active img { transform: scale(0.96); }
  .thumb-wrap:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }

  .processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--muted);
    cursor: pointer;
  }
  .processing-overlay.error {
    background: rgba(192,57,43,0.35);
    color: #ffd4cc;
  }
  .processing-overlay .stuck-hint {
    font-size: 0.62rem;
    opacity: 0.7;
    margin-top: 0.2rem;
  }

  .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  @keyframes spin { to { transform: rotate(360deg); } }

  .skeleton {
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: 6px;
    aspect-ratio: 1;
  }

  .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted);
  }

  .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
  }

  #lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 200;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(var(--safe-top) + 3.5rem) 0 calc(var(--safe-bot) + 4rem);
  }

  #lightbox.active { display: flex; }

  .lb-media {
    max-width: 90dvw;
    max-height: 90dvh;
    object-fit: contain;
    border-radius: 4px;
  }

  .lb-video {
    max-width: 90dvw;
    max-height: 90dvh;
    border-radius: 4px;
  }

  .lb-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .lb-name {
    font-size: 0.85rem;
    color: var(--bg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
  }

  .lb-actions {
    display: flex;
    gap: 0.5rem;
  }

  .lb-btn:hover { opacity: .5; }
  .lb-btn.delete-btn:hover { background: rgba(192,57,43,0.6); }
  .lb-btn:disabled { opacity: 0.3; cursor: default; }

  .lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
  }
  .lb-nav:hover { opacity: .5; }
  .lb-nav:disabled { opacity: .25; pointer-events: none; }
  .lb-nav.prev { left: 1rem; }
  .lb-nav.next { right: 1rem; }

  @media (max-width: 600px) {
    .lb-nav { display: none; }
  }

  #lb-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }
  #lb-content.swipe-out-left  { transform: translateX(-40%); opacity: 0; }
  #lb-content.swipe-out-right { transform: translateX(40%);  opacity: 0; }
  #lb-content.swipe-in-left   { transform: translateX(40%);  opacity: 0; }
  #lb-content.swipe-in-right  { transform: translateX(-40%); opacity: 0; }

  #toast {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(200%);
    background: var(--bg);
    color: var(--white);
    font-weight: 600;
    font-size: 1.35rem;
    padding: 1rem;
    border-radius: var(--radius);
    z-index: 300;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    pointer-events: none;
  }

  #toast.show { transform: translateX(-50%) translateY(0); }
  #toast.success { }
  #toast.error   { }

  #confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    padding-bottom: calc(var(--safe-bot) + 1rem);
  }

  #confirm-overlay.active { display: flex; }

  @keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
