:root {
  --bg: #100e0c;
  --bg-soft: #181512;
  --panel: #1c1915;
  --panel-2: #241f1a;
  --line: rgba(244, 228, 208, 0.12);
  --line-strong: rgba(244, 228, 208, 0.22);
  --text: #f6efe6;
  --muted: #b5a89a;
  --faint: #7d7268;
  --accent: #e7b07a;
  --accent-deep: #c4894e;
  --accent-soft: rgba(231, 176, 122, 0.14);
  --ok: #9dbe8c;
  --ok-bg: rgba(157, 190, 140, 0.12);
  --error: #e08a7a;
  --error-bg: rgba(224, 138, 122, 0.12);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  --radius: 22px;
  --radius-sm: 14px;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
  --display: Syne, "Zen Kaku Gothic New", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background: var(--bg);
}

body {
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(231, 176, 122, 0.16), transparent 58%),
    radial-gradient(700px 520px at 110% 8%, rgba(143, 168, 150, 0.12), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 35%, transparent 80%);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.25rem 0 calc(2rem + env(safe-area-inset-bottom));
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.auth-card {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-pane {
  padding: 1.5rem 1.4rem 1.25rem;
  background:
    linear-gradient(160deg, rgba(231, 176, 122, 0.16), transparent 55%),
    var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--accent);
  margin-bottom: 1.1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}

.brand-pane h1,
.page-head h1,
.panel h2 {
  font-family: var(--display);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.brand-pane h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(2rem, 6vw, 3.1rem);
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 36ch;
}

.auth-form {
  padding: 1.4rem 1.25rem 1.5rem;
}

.auth-form h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
}

.hint {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.field {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.field span {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.field-control {
  position: relative;
}

input[type="password"],
input[type="text"],
input[type="search"] {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 3rem 0.8rem 0.95rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  font-size: 16px;
}

input[type="search"] {
  padding-right: 0.95rem;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.toggle-pw {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
}

.toggle-pw:hover,
.toggle-pw:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 48px;
  padding: 0.75rem 1.1rem;
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

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

.btn-primary {
  width: 100%;
  color: #1a140f;
  background: linear-gradient(180deg, #f0c395, var(--accent));
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: linear-gradient(180deg, #f6d2ad, #ebb888);
}

.btn-ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-lockup strong {
  display: block;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -0.04em;
}

.brand-lockup small {
  display: block;
  color: var(--faint);
  font-size: 0.78rem;
}

.flashes {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.flash {
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.flash.ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: rgba(157, 190, 140, 0.28);
}

.flash.error {
  color: var(--error);
  background: var(--error-bg);
  border-color: rgba(224, 138, 122, 0.3);
}

.layout {
  display: grid;
  gap: 1rem;
}

.panel {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1.45rem;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 210px;
  margin: 1rem 0 0.85rem;
  padding: 1.25rem;
  text-align: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(231, 176, 122, 0.07), transparent 70%),
    rgba(0, 0, 0, 0.16);
  cursor: pointer;
}

.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 0.7rem;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--accent);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
}

.dropzone p {
  margin: 0;
}

.dropzone .sub {
  margin-top: 0.3rem;
  color: var(--faint);
  font-size: 0.88rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.9rem;
  padding: 0;
  list-style: none;
}

.chips:empty {
  display: none;
}

.chip {
  max-width: 100%;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.count {
  color: var(--muted);
  font-size: 0.9rem;
}

.file-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid transparent;
}

.file-row:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.ext {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.file-name {
  margin: 0;
  font-weight: 700;
  word-break: break-all;
}

.file-meta {
  margin: 0.15rem 0 0;
  color: var(--faint);
  font-size: 0.82rem;
}

.file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.delete-form {
  margin: 0;
}

.btn-small {
  min-height: 40px;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
}

.btn-copy {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(231, 176, 122, 0.28);
}

.btn-copy:hover:not(:disabled),
.btn-copy:focus-visible {
  background: rgba(231, 176, 122, 0.24);
}

.btn-delete {
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid rgba(224, 138, 122, 0.3);
}

.btn-delete:hover,
.btn-delete:focus-visible {
  background: rgba(224, 138, 122, 0.2);
}

.empty {
  margin: 0;
  padding: 1.6rem 0.5rem;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  .auth-card {
    grid-template-columns: 1.05fr 0.95fr;
    min-height: 520px;
  }

  .brand-pane {
    padding: 2.4rem 2rem;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }

  .auth-form {
    padding: 2.2rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .layout {
    grid-template-columns: 0.92fr 1.08fr;
    align-items: start;
  }

  .btn-primary {
    width: auto;
    min-width: 180px;
  }

  .upload-actions {
    display: flex;
    justify-content: flex-end;
  }
}

@media (min-width: 960px) {
  .shell {
    padding-top: 2rem;
  }
}

@media (max-width: 719px) {
  .file-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .file-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .topbar .btn-ghost {
    min-width: 44px;
    padding-inline: 0.85rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
