@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&display=swap');

:root {
  --ink: #14140f;
  --paper: #ffffff;
  --paper-soft: #f7f6f2;
  --line: #e8e6df;
  --sun: #ffc94a;
  --sun-deep: #e0a800;
  --muted: #6f6d64;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Noto Sans TC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand img {
  height: 30px;
  width: auto;
  display: block;
}

.brand-text {
  font-weight: 900;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); background: var(--paper-soft); }
.btn:active { transform: translateY(0); }

.btn-solid {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-solid:hover { background: #2a2a22; }

.btn-ghost {
  border-color: transparent;
  background: transparent;
  font-weight: 500;
  color: var(--muted);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.user-chip strong { color: var(--ink); }

.hero {
  padding: 46px 18px 22px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 900;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.feed-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 14px 120px;
}

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card .img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--paper-soft);
  overflow: hidden;
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card .meta {
  padding: 10px 12px 12px;
}
.card .caption {
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 4px;
  word-break: break-word;
}
.card .time {
  font-size: 11px;
  color: var(--muted);
}

.empty-state, .loading-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 14px;
}

.fab {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 30;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 24px rgba(20,20,15,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.fab:hover { transform: scale(1.06); background: var(--sun-deep); }
.fab:active { transform: scale(0.97); }
.fab[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,20,15,0.4);
  backdrop-filter: blur(2px);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 640px) {
  .overlay { align-items: center; }
}
.hidden { display: none !important; }

.modal {
  background: var(--paper);
  width: 100%;
  max-width: 460px;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 26px;
  max-height: 88vh;
  overflow-y: auto;
}
@media (min-width: 640px) {
  .modal { border-radius: 20px; }
}

.modal h2 {
  font-size: 18px;
  margin: 0 0 14px;
  font-weight: 900;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.photo-picker {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  position: relative;
  background: var(--paper-soft);
}
.photo-picker input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.photo-picker .hint {
  font-size: 13px;
  color: var(--muted);
}
.preview {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 10px;
  margin-top: 10px;
  display: none;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 64px;
  background: var(--paper);
}
textarea:focus, input:focus { outline: 2px solid var(--sun); outline-offset: 1px; }

.notice {
  font-size: 12px;
  color: var(--muted);
  background: var(--paper-soft);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.modal-actions .btn { flex: 1; text-align: center; padding: 12px; }

.error-text {
  color: #b3261e;
  font-size: 12px;
  margin-top: 6px;
  display: none;
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: -3px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 20px;
}
