/* ============================================================
   Global Design Tokens & Base Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Backgrounds */
  --bg-primary: #1e2124;
  --bg-secondary: #2c2f33;
  --bg-tertiary: #36393f;
  --bg-hover: #3e4147;

  /* Accent */
  --accent: #7289da;
  --accent-hover: #677bc4;
  --accent-active: #5b6db0;
  --accent-text: #7289da;   /* 4.5:1+ on --bg-secondary — text-safe accent */
  --accent-btn:  #4e5faf;   /* 4.5:1+ with white text — button-safe accent */

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #b9bbbe;
  --text-muted: #72767d;

  /* Borders */
  --border: #40444b;
  --border-light: #4f545c;

  /* Status */
  --success: #43b581;
  --danger: #f04747;
  --warning: #faa61a;
  --gold: #f1c40f;

  /* Spacing */
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-inset: inset 0 1px 3px rgba(0, 0, 0, 0.3);

  /* Transitions */
  --transition: 0.15s ease;
  --transition-slow: 0.3s ease;

  /* App shell: same right-rail flex on Game + Characters (UI-011) */
  --right-sidebar-flex: 0 0 clamp(260px, 28%, 440px);
  --right-sidebar-flex-narrow: 0 0 clamp(240px, 26%, 380px);
  --left-panel-width: clamp(240px, 20%, 320px);
  --left-panel-width-narrow: clamp(200px, 18%, 280px);
  --dice-l-stage-height: clamp(168px, 28vh, 280px);

  /* Typography */
  --font: 'Inter', Arial, sans-serif;
  --font-size-sm: 13px;
  --font-size-base: 15px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 22px;
  --font-size-2xl: 28px;
}

/* ============================================================
   Base Reset & Global Styles
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--font-size-base);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Base Element Styles
   ============================================================ */

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

/* ============================================================
   Shared Button Styles
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition), box-shadow var(--transition);
  outline: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--accent-btn);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-primary:active {
  background-color: var(--accent-active);
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.btn-ghost:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

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

.btn-danger:hover {
  background-color: #d43f3f;
}

.btn-full {
  width: 100%;
}

/* ============================================================
   Shared Input Styles
   ============================================================ */

.input {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--font-size-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(114, 137, 218, 0.5);
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* ============================================================
   Shared Card
   ============================================================ */

.card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ============================================================
   Utility
   ============================================================ */

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

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.text-muted {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.text-secondary {
  color: var(--text-secondary);
}

/* ============================================================
   Scrollbar
   ============================================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
