/* ─── Auth pages (login, verify, profile) ─── */

/* style.css に .hidden がないため auth.css で明示定義 */
.hidden { display: none !important; }

.auth-page {
  min-height: 80vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  padding-top: max(2rem, 10vh);
}

.auth-box {
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  padding: 2.5rem 2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.auth-box-wide { max-width: 520px; }

.auth-logo {
  font-size: 3rem;
  margin-bottom: .5rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 .75rem;
}

.auth-desc {
  color: #555;
  font-size: .95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.auth-welcome {
  background: linear-gradient(135deg, #06D6A0, #118AB2);
  color: #fff;
  border-radius: .75rem;
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
}

/* ─── Form ─── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  text-align: left;
}

.auth-form label {
  font-size: .9rem;
  font-weight: 600;
  color: #333;
}

.auth-optional {
  font-weight: 400;
  color: #888;
  font-size: .82rem;
}

.auth-form input[type="email"],
.auth-form input[type="text"],
.auth-form select {
  width: 100%;
  padding: .75rem 1rem;
  border: 2px solid #ddd;
  border-radius: .75rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color .2s;
  box-sizing: border-box;
}

.auth-form input:focus,
.auth-form select:focus {
  outline: none;
  border-color: #118AB2;
}

.btn-auth {
  display: block;
  width: 100%;
  padding: .9rem 1.5rem;
  background: linear-gradient(135deg, #118AB2, #06D6A0);
  color: #fff;
  border: none;
  border-radius: .75rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  margin-top: .5rem;
}

.btn-auth:hover  { opacity: .9; }
.btn-auth:active { transform: scale(.98); }
.btn-auth:disabled { opacity: .55; cursor: not-allowed; }

/* ─── Success / Error states ─── */
.auth-success {
  padding: 1.5rem;
  background: #f0fff8;
  border-radius: 1rem;
  border: 2px solid #06D6A0;
}

.auth-success-icon { font-size: 2.5rem; margin-bottom: .5rem; }

.auth-success h2 {
  font-size: 1.25rem;
  color: #1a1a2e;
  margin: 0 0 .5rem;
}

.auth-success p { color: #555; line-height: 1.6; }

.auth-error {
  background: #fff0f0;
  border: 2px solid #EF476F;
  border-radius: .75rem;
  padding: .75rem 1rem;
  color: #c0392b;
  font-size: .9rem;
}

.auth-note { font-size: .82rem; color: #888; margin-top: .75rem; }

/* ─── Email-sent banner (Step 2 top) ─── */
.auth-sent-banner {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #f0fff8;
  border: 2px solid #06D6A0;
  border-radius: .75rem;
  padding: .85rem 1rem;
  text-align: left;
  margin-bottom: .25rem;
}
.auth-sent-icon { font-size: 1.75rem; flex-shrink: 0; }
.auth-sent-email { font-size: .82rem; color: #555; word-break: break-all; }

/* ─── OTP input ─── */
.otp-input-wrap {
  margin: .25rem 0 .5rem;
}
.otp-input-wrap input {
  width: 100%;
  font-size: 2.6rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  letter-spacing: .45em;
  text-align: center;
  padding: .6rem .5rem .6rem 1.1em; /* compensate letter-spacing indent */
  border: 2px solid #ddd;
  border-radius: .75rem;
  box-sizing: border-box;
  transition: border-color .2s;
  -moz-appearance: textfield;
}
.otp-input-wrap input:focus {
  outline: none;
  border-color: #118AB2;
}
.otp-input-wrap input::placeholder {
  letter-spacing: .45em;
  color: #ccc;
  padding-left: 1.1em;
}

/* ─── Alt (resend / back) ─── */
.auth-alt {
  margin-top: 1rem;
  border-top: 1px solid #eee;
  padding-top: .85rem;
}
.auth-resend {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .4rem;
}
.auth-resend-timer {
  font-size: .82rem;
  color: #888;
}
.auth-back-btn {
  background: none;
  border: none;
  color: #888;
  font-size: .82rem;
  cursor: pointer;
  padding: 0;
  margin-top: .75rem;
  text-decoration: underline;
  display: block;
  text-align: center;
  width: 100%;
}
.auth-back-btn:hover { color: #333; }

/* ─── Profile extras ─── */
.auth-hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 2rem 0 1.5rem;
}

.auth-info {
  text-align: left;
  font-size: .9rem;
  color: #555;
}

.auth-info p { margin: 0 0 .75rem; }

.btn-secondary-sm {
  background: none;
  border: 1.5px solid #ccc;
  border-radius: .5rem;
  padding: .4rem .9rem;
  font-size: .85rem;
  cursor: pointer;
  color: #555;
  transition: border-color .2s, color .2s;
}

.btn-secondary-sm:hover { border-color: #EF476F; color: #EF476F; }

/* ─── Header auth nav ─── */
.nav-user { display: flex; align-items: center; gap: .6rem; }
.nav-user-name { font-size: .9rem; color: #333; font-weight: 600; }
.nav-login-btn {
  background: linear-gradient(135deg, #118AB2, #06D6A0);
  color: #fff;
  border: none;
  border-radius: .5rem;
  padding: .35rem .85rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity .2s;
}
.nav-login-btn:hover { opacity: .88; }

/* ─── Records screen tabs ─── */
.records-tab-bar {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #eee;
  padding-bottom: .5rem;
}

.records-tab-btn {
  flex: 1;
  background: none;
  border: 2px solid #ddd;
  border-radius: .5rem;
  padding: .5rem .75rem;
  font-size: .9rem;
  cursor: pointer;
  color: #666;
  font-family: inherit;
  transition: all .2s;
}

.records-tab-btn.active {
  background: #118AB2;
  border-color: #118AB2;
  color: #fff;
  font-weight: 700;
}

.records-panel { display: block; }
.records-panel.hidden { display: none; }

.records-source-note {
  font-size: .8rem;
  color: #888;
  margin: .5rem 0 0;
  text-align: center;
}

.records-login-prompt {
  background: #f0f8ff;
  border: 2px solid #118AB2;
  border-radius: .75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: .9rem;
  line-height: 1.5;
  text-align: center;
}

.records-login-prompt a {
  display: inline-block;
  margin-top: .5rem;
  background: #118AB2;
  color: #fff;
  border-radius: .5rem;
  padding: .4rem 1rem;
  font-size: .85rem;
  text-decoration: none;
}

/* ─── Leaderboard sub-tabs ─── */
.lb-sub-tab-bar {
  display: flex;
  gap: .4rem;
  margin-bottom: .75rem;
}

.lb-tab-btn {
  flex: 1;
  background: none;
  border: 1.5px solid #ddd;
  border-radius: .4rem;
  padding: .4rem;
  font-size: .82rem;
  cursor: pointer;
  color: #666;
  font-family: inherit;
  transition: all .2s;
}

.lb-tab-btn.active {
  background: #06D6A0;
  border-color: #06D6A0;
  color: #fff;
  font-weight: 700;
}

.lb-panel { display: block; }
.lb-panel.hidden { display: none; }

.lb-loading {
  text-align: center;
  color: #888;
  padding: 2rem;
  font-size: .9rem;
}

/* ─── Email-notify toggle row ─── */
.notify-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  background: #f8f9fa;
  border: 1.5px solid #ddd;
  border-radius: .75rem;
}

.notify-label {
  font-size: .9rem;
  color: #333;
  line-height: 1.4;
  flex: 1;
}

.notify-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.notify-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.notify-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: background .25s;
}

.notify-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s;
}

.notify-toggle input:checked + .notify-slider {
  background: #06D6A0;
}

.notify-toggle input:checked + .notify-slider::before {
  transform: translateX(22px);
}

/* ─── Dark theme overrides ─── */
[data-theme="terminal"] .auth-box,
[data-theme="terminal"] .records-login-prompt {
  background: #1a1a1a;
  color: #00ff41;
  border-color: #00ff41;
}

[data-theme="terminal"] .records-tab-btn {
  border-color: #444;
  color: #aaa;
}

[data-theme="terminal"] .records-tab-btn.active {
  background: #00ff41;
  border-color: #00ff41;
  color: #000;
}
