/* base.css — 配色、リセット、ヘッダー、共通フォーム */

:root {
  color-scheme: dark;
  --bg: #0d1714;
  --panel: #17241f;
  --panel-light: #22352e;
  --panel-strong: #0b1210;
  --border: #40584e;
  --text: #f3f0e6;
  --muted: #a8b9b0;
  --felt: #176044;
  --felt-mid: #104d37;
  --felt-dark: #093425;
  --ivory: #f7f0d9;
  --ivory-edge: #cfc3a2;
  --ink: #172019;
  --gold: #e0b95c;
  --gold-dark: #97752c;
  --accent: #2f9b70;
  --accent-dark: #217052;
  --danger: #c94e4e;
  --danger-dark: #823636;
  --info: #3d719b;
  --warning: #e0b95c;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tile-w: 34px;
  --tile-h: 48px;
  --mini-tile-w: 22px;
  --mini-tile-h: 31px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -20%, #1a332b 0, transparent 48%),
    var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

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

.app-header {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: calc(7px + var(--safe-top)) 12px 7px;
  background: rgba(18, 31, 26, 0.98);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.25);
}

.app-header h1 {
  margin-right: auto;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.header-round,
.header-points {
  white-space: nowrap;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.header-round {
  color: var(--gold);
  font-weight: 700;
}

.header-points {
  color: var(--text);
}

.app-header nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.menu-toggle {
  display: none;
}

.btn {
  appearance: none;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-light);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.btn:hover:not(:disabled) {
  background: #2e473d;
  border-color: #607b70;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #fff3aa;
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.btn--small {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}

.btn--primary {
  border-color: var(--gold-dark);
  background: #b98b2d;
  color: #11170f;
}

.btn--primary:hover:not(:disabled) {
  background: var(--gold);
  border-color: #f1d58b;
}

.btn--danger {
  border-color: var(--danger-dark);
  background: var(--danger);
  color: #fff;
}

.btn--quiet {
  background: transparent;
}

.banner {
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--danger-dark);
  color: #fff;
  font-size: 13px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.form-label {
  color: var(--muted);
  font-size: 13px;
}

.form-row input[type="number"],
.form-row select,
.form-row input[type="text"],
.form-row input[type="password"] {
  width: min(190px, 56%);
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 16px;
}

.form-row--check {
  justify-content: flex-start;
}

.form-row--check input {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
}

.form-note {
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.form-error {
  min-height: 1.3em;
  margin: 8px 0;
  color: #ffb5b5;
  font-size: 13px;
}

/* login.php/setup.php も同じ基礎CSSを利用できる。 */
.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: auto;
}

.login-box {
  width: min(100%, 380px);
  padding: 28px 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.login-box h1 {
  margin-bottom: 20px;
  text-align: center;
  font-size: 20px;
}

.login-box .form-row {
  display: block;
}

.login-box .form-row input,
.login-box .btn {
  width: 100%;
  max-width: none;
}

.login-error {
  margin-bottom: 12px;
  color: #ffb5b5;
  text-align: center;
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
