:root {
  --bg: #0E4749;
  --bg-elevated: #14595c;
  --accent: #FF8C42;
  --accent-dark: #e0722c;
  --text: #FDF6EC;
  --text-muted: #cfe3e0;
  --error: #ffb4a2;
  --error-bg: #5c2a24;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

#app,
.admin-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  min-height: 100vh;
}

.admin-container {
  max-width: 800px;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 20px;
}

h2 {
  font-size: 1.3rem;
  margin: 0 0 8px;
}

/* Login */
.login-hero {
  text-align: center;
  margin-bottom: 32px;
}
.login-hero .emoji {
  font-size: 3rem;
}
.login-hero h1 {
  margin-top: 8px;
}
.login-hero p {
  color: var(--text-muted);
}

.field-wrap {
  margin-bottom: 18px;
}
.field-wrap label {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.05rem;
  font-family: inherit;
}
input::placeholder,
textarea::placeholder {
  color: rgba(253, 246, 236, 0.4);
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

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

.btn-primary {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: #1a1006;
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 8px;
}
.btn-primary:active {
  background: var(--accent-dark);
}
.btn-primary:disabled {
  opacity: 0.5;
}

.btn-secondary {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--accent);
  border-radius: 14px;
  background: transparent;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 12px;
}
.btn-secondary:disabled {
  opacity: 0.5;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 8px 0;
  margin-bottom: 12px;
}

.error-text {
  color: var(--error);
  background: var(--error-bg);
  padding: 12px 14px;
  border-radius: 12px;
  margin-top: 12px;
  font-size: 0.95rem;
}

/* Home */
.home-header {
  margin-bottom: 24px;
}
#home-greeting {
  font-size: 1.3rem;
  font-weight: 700;
  display: block;
}
#home-usage {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.template-card {
  background: var(--bg-elevated);
  border: none;
  border-radius: var(--radius);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  color: var(--text);
  min-height: 150px;
}
.template-card:active {
  background: #1c6a6d;
}
.template-icon {
  font-size: 2.4rem;
}
.template-name {
  font-size: 1.05rem;
  font-weight: 700;
}
.template-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Template view */
#template-title {
  margin-bottom: 4px;
}
#template-subtitle {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.queue-indicator {
  background: rgba(255, 140, 66, 0.15);
  color: var(--accent);
  padding: 12px 14px;
  border-radius: 12px;
  margin: 16px 0;
  text-align: center;
}

.result-wrap {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}
.result-text {
  white-space: pre-wrap;
  font-size: 1.05rem;
  line-height: 1.8;
}
.model-label {
  text-align: right;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 10px 0 0;
}

.followup-wrap {
  margin-top: 16px;
}
#followup-round-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Admin */
.admin-body {
  background: #f4f1ea;
  color: #1a1a1a;
}
.admin-container h1 {
  color: #1a1a1a;
}
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}
.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  text-align: left;
  font-size: 0.95rem;
}
.admin-table th {
  background: var(--bg);
  color: var(--text);
}
.admin-toolbar button {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #1a1006;
  font-weight: 600;
}
.admin-container input[type="password"] {
  color: #1a1a1a;
  background: #fff;
  border-color: #ccc;
  margin-bottom: 12px;
}

.admin-model-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.admin-model-section h2 {
  color: #1a1a1a;
  font-size: 1.1rem;
  margin-bottom: 12px;
}
.admin-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.admin-model-row label {
  color: #1a1a1a;
  font-size: 0.95rem;
}
.admin-model-row select {
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 6px 10px;
  max-width: 220px;
}
.admin-toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
}
.admin-models-table {
  margin-top: 8px;
}
.admin-models-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}
