:root {
  --bg: #f5eee5;
  --bg-deep: #eadcc9;
  --surface-strong: rgba(255, 255, 255, 0.98);
  --line: rgba(76, 50, 24, 0.14);
  --ink: #1f1610;
  --muted: rgba(31, 22, 16, 0.66);
  --accent: #cc744a;
  --accent-deep: #9d4928;
  --teal: #355d63;
  --shadow-soft: 0 28px 70px rgba(54, 31, 15, 0.14);
  --radius-xl: 34px;
  --font-sans: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-display: "Aptos Display", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 14%, rgba(204, 116, 74, 0.22), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(53, 93, 99, 0.14), transparent 18%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.is-hidden {
  display: none !important;
}

.portal-app {
  min-height: 100vh;
  padding: 24px;
}

.portal-login-screen,
.dashboard-shell {
  width: min(1380px, 100%);
  margin: 0 auto;
}

.portal-login-screen {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.portal-login-shell {
  width: min(440px, 100%);
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 800;
}

.portal-login-card h1 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  font-size: clamp(2.2rem, 5vw, 3rem);
  line-height: 1;
}

.portal-login-card {
  padding: clamp(24px, 4vw, 34px);
  display: grid;
  gap: 16px;
  align-content: start;
  background: var(--surface-strong);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.portal-form-head {
  display: grid;
  gap: 12px;
}

.portal-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.portal-field span {
  font-size: 0.96rem;
}

.portal-field input {
  width: 100%;
  min-height: 60px;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 16px 18px;
  font-size: 1rem;
  color: var(--ink);
  background: rgba(255, 252, 248, 0.98);
}

.portal-field input:focus {
  outline: 2px solid rgba(204, 116, 74, 0.2);
  outline-offset: 2px;
  border-color: rgba(157, 73, 40, 0.3);
}

.primary-btn {
  min-height: 60px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #fff9f3;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 22px 34px rgba(157, 73, 40, 0.22);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-btn:hover,
.primary-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 26px 38px rgba(157, 73, 40, 0.26);
  outline: none;
}

.error-text {
  min-height: 1.5em;
  margin: 0;
  color: #b44734;
  font-weight: 700;
}

.console-frame {
  width: 100%;
  min-height: calc(100vh - 48px);
  border: 0;
  border-radius: var(--radius-xl);
  background: transparent;
}

@media (max-width: 980px) {
  .portal-login-screen {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .portal-app {
    padding: 14px;
  }

  .portal-login-screen {
    min-height: calc(100vh - 28px);
  }

  .portal-story-card,
  .portal-login-card {
    padding: 22px 18px;
    border-radius: 26px;
  }

  .portal-story-card h1 {
    font-size: 2.5rem;
  }

  .portal-login-card h2 {
    font-size: 2rem;
  }

  .portal-field input,
  .primary-btn {
    min-height: 58px;
  }
}