* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-page: #f5f6f8;
  --bg-card: #ffffff;
  --bg-card-alt: #f9fafc;
  --bg-upload: #ffffff;
  --bg-thumb: #eef0f4;
  --border-color: rgba(0, 0, 0, 0.08);
  --text-main: #1a1a1f;
  --text-dim: #6b6f7a;
  --text-faint: #9ca1af;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --danger: #dc2626;
  --radius-lg: 12px;
  --radius-md: 8px;
  --shadow-card: 0 24px 48px rgba(0, 0, 0, 0.06);
  --shadow-header: 0 12px 24px rgba(0, 0, 0, 0.08);
  --shadow-pop: 0 20px 40px rgba(0, 0, 0, 0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
}

/* NAVBAR */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: radial-gradient(circle at 20% 20%, #ffffff 0%, #d4d8dd 70%);
  color: #111;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.03em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

nav a.menu-link {
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
  padding-bottom: 4px;
}

nav a.menu-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.18s ease;
}

nav a.menu-link.active {
  color: var(--accent);
}

nav a.menu-link.active::after,
nav a.menu-link:hover::after {
  width: 100%;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-info {
  font-size: 0.7rem;
  color: var(--text-main);
  line-height: 1.2;
  text-align: right;
}

.user-info div[style] {
  color: var(--text-dim) !important;
}

.logout-btn {
  background: var(--danger);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(220, 38, 38, 0.35);
  transition: opacity 0.15s;
}

.logout-btn:hover {
  opacity: 0.9;
}

/* HERO */
.page-hero {
  max-width: 1200px;
  width: 100%;
  margin: 5rem auto 1.5rem;
  padding: 0 1.5rem;
}

.page-hero-title {
  font-size: clamp(1.3rem, 1vw + 1rem, 1.6rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.page-hero-desc {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-dim);
  max-width: 600px;
}

/* MAIN */
main {
  flex: 1;
}

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.info-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  padding: 1rem 1rem 0.9rem;
}

.card small {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card h3 {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.4;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--text-main);
}

.card p {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--text-dim);
}

/* UPLOAD BLOCK */
.upload-block {
  background: var(--bg-upload);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 1rem;
}

.upload-header-bar {
  width: 100%;
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
}

.upload-head-left h4 {
  font-size: 0.8rem;
  color: var(--text-main);
  font-weight: 600;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.upload-head-left span {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.upload-head-right {
  font-size: 0.65rem;
  color: var(--text-faint);
  line-height: 1.3;
  text-align: right;
}

.toggle-indicator {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  line-height: 1.2;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
  user-select: none;
}

.upload-body {
  display: none;
  padding: 1rem 1rem 1.25rem;
}

/* FORM */
.upload-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-card);
}

.upload-form-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.upload-form-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.upload-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.upload-row label {
  font-size: 0.7rem;
  color: var(--text-main);
  font-weight: 500;
}

.input-field,
.input-file {
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.6rem;
  font-size: 0.75rem;
  outline: none;
  width: 100%;
}

.input-field:focus,
.input-file:focus {
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.upload-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 15px 35px rgba(37, 99, 235, 0.35);
  width: fit-content;
}

.upload-msg {
  font-size: 0.7rem;
  min-height: 1em;
  color: #16a34a;
  font-weight: 500;
}

/* FILE LIST */
.file-list-wrapper {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1rem 1rem 1.25rem;
}

.file-list-wrapper h5 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(500px, 100%), 1fr));
  gap: 1rem;
}

.file-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  position: relative;
}

.delete-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(220, 38, 38, 0.3);
}

.file-thumb {
  width: 110px;
  min-width: 110px;
  height: 150px;
  border-radius: var(--radius-md);
  background: var(--bg-thumb);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.6rem;
  line-height: 1.2;
  color: var(--text-main);
  font-weight: 500;
  overflow: hidden;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-md);
}

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-tag-row {
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.file-title-row {
  font-size: 0.9rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

.file-sub-row {
  font-size: 0.75rem;
  line-height: 1.4;
  font-weight: 500;
  color: var(--text-dim);
  word-break: break-word;
}

.file-meta-row {
  font-size: 0.65rem;
  line-height: 1.4;
  color: var(--text-faint);
}

.file-open-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
}

.file-open-link:hover {
  text-decoration: underline;
}

/* LOGIN PAGE */
.login-page {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #ffffff 0%, #d9dde5 60%);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-box {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 1.25rem 1.25rem 1rem;
}

.login-header {
  margin-bottom: 1rem;
  text-align: center;
}

.login-header .brand-mini {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.brand-logo.small {
  width: 28px;
  height: 28px;
  font-size: 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: radial-gradient(circle at 20% 20%, #ffffff 0%, #d4d8dd 70%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.login-header h2 {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.login-header p {
  margin-top: 0.4rem;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--text-dim);
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.7rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.form-group input {
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.6rem;
  font-size: 0.75rem;
  outline: none;
}

.form-group input:focus {
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 15px 35px rgba(37, 99, 235, 0.35);
  transition: opacity 0.15s;
}

.login-btn:hover {
  opacity: 0.9;
}

.login-error {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--danger);
  min-height: 1.2em;
  margin-top: 0.25rem;
  text-align: center;
}

footer {
  color: var(--text-faint);
  font-size: 0.6rem;
  text-align: center;
  padding: 2rem 1rem 3rem;
  border-top: 1px solid var(--border-color);
  background: transparent;
}

@media (max-width: 600px) {
  header {
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    justify-content: center;
    text-align: center;
  }

  .user-area {
    flex-direction: row;
  }

  .user-info {
    text-align: left;
  }

  .file-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .file-thumb {
    width: 100%;
    max-width: 160px;
    min-width: 0;
    height: 220px;
  }

  .delete-btn {
    top: auto;
    right: auto;
    position: relative;
    margin-top: 0.5rem;
    align-self: flex-start;
  }
}