:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-text: #ffffff;
  --danger: #dc2626;
  --success: #16a34a;
}

[data-theme='dark'] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --primary: #3b82f6;
  --primary-text: #ffffff;
  --danger: #f87171;
  --success: #4ade80;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.1rem;
  padding: 8px 12px;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--border);
}

.content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
}

.tab.active {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.btn-primary {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 1rem;
  cursor: pointer;
  margin-top: 6px;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  margin-top: 10px;
}

.form-message {
  min-height: 20px;
  font-size: 0.9rem;
  margin-top: 10px;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: var(--success);
}

.account-panel {
  text-align: center;
}

.account-panel .email {
  font-weight: 600;
  margin-bottom: 4px;
}

.account-panel .role {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.resume-banner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.resume-banner p {
  margin: 0;
}

.resume-banner-heading {
  font-weight: 700;
}

/* the resume banner is a dropdown (<details>): collapsed by default, the heading with the count is the
   toggle and the list opens under it */
details.resume-dropdown { display: block; }
details.resume-dropdown > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}
details.resume-dropdown > summary::-webkit-details-marker { display: none; }
details.resume-dropdown > summary::after { content: '▾'; transition: transform 0.2s; }
details.resume-dropdown[open] > summary::after { transform: rotate(180deg); }
details.resume-dropdown > .resume-list { margin-top: 10px; }
details.resume-dropdown > .gt-hint { margin-top: 8px; }

.resume-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.resume-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: start;
}

.resume-row-teams {
  font-weight: 700;
}

.resume-row-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.resume-row .resume-row-link {
  width: auto;
  flex: none;
  padding: 6px 14px;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

/* Technical LTR content (hex codes, ids, file sizes, timestamps) needs
   explicit direction isolation inside RTL layout — otherwise the Unicode
   bidi algorithm can reorder leading symbols like "#" inconsistently
   depending on whether the first strong character is a letter or digit. */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

/* Branding (Section 16): uploaded logo/icon images, swapped in by
   branding.js only once they are known to load. */
.brand-logo-img {
  height: 32px;
  display: block;
}

/* Links styled as buttons on the account view ("بدء لعبة جديدة", the
   admin link) must lay out like the real buttons beside them. */
.account-panel > a.btn-primary,
.account-panel > a.btn-secondary {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-bottom: 10px;
}
