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

:root {
  --bg: #111119;
  --surface: rgba(18, 18, 26, 0.82);
  --surface-hover: rgba(30, 30, 42, 0.9);
  --border-gold: rgba(229, 181, 79, 0.82);
  --border-dark: #17120d;
  --text: #f8f0de;
  --text-dim: #a89b82;
  --gold: #e5b54f;
  --gold-bright: #f4d189;
  --parchment: #f1dfbd;
  --parchment-light: #f5e7c9;
  --brown-dark: #2a1b0a;
  --accent: #71e08c;
  --accent-dim: rgba(113, 224, 140, 0.15);
  --red: #ff6f69;
  --red-dim: rgba(255, 111, 105, 0.15);
  --btn-primary: #a88947;
  --btn-secondary: #664730;
  --btn-ghost: #2c2a31;
  --popup-bg: rgba(14, 14, 20, 0.97);
}

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

body {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 14px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */

header {
  padding: 16px 0 12px;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-back {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  background: var(--surface);
  color: var(--gold-bright);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.btn-back:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

header h1 {
  font-size: 22px;
  font-weight: 900;
  color: var(--gold-bright);
  letter-spacing: -0.3px;
}

.subtitle {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
  text-transform: uppercase;
}

/* Tabs */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-gold);
  padding-bottom: 0;
  margin-bottom: 12px;
}

.tab {
  padding: 8px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--text-dim);
  font-weight: 800;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.15s;
}

.tab.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
}

/* Request List */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.request-card {
  display: flex;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.vote-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 38px;
}

.vote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.vote-btn:active {
  transform: translateY(1px);
}

.vote-btn.up.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.vote-btn.down.active {
  color: var(--red);
  background: var(--red-dim);
}

.vote-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.vote-count {
  font-size: 14px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  padding: 2px 0;
}

.request-content {
  flex: 1;
  min-width: 0;
  user-select: text;
  -webkit-user-select: text;
}

.request-title {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
}

.request-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
  line-height: 1.4;
  font-weight: 650;
}

.badge-implemented {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  font-size: 10px;
  font-weight: 900;
  color: var(--accent);
  text-transform: uppercase;
}

.badge-implemented::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 0;
  font-size: 13px;
  font-weight: 700;
}

/* Submission Cards */

.submission-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 12px;
  padding-right: 44px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  margin-bottom: 8px;
}

.submission-content {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

.submission-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.submission-date {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 700;
}

.badge-status {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-pending {
  color: var(--gold);
}

.badge-pending::before {
  background: var(--gold);
}

.badge-planned {
  color: var(--accent);
}

.badge-planned::before {
  background: var(--accent);
}

.badge-noted {
  color: var(--text-dim);
}

.badge-noted::before {
  background: var(--text-dim);
}

.badge-added {
  color: #71b0e0;
}

.badge-added::before {
  background: #71b0e0;
}

.btn-delete-submission {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 111, 105, 0.3);
  border-radius: 6px;
  background: var(--red-dim);
  color: var(--red);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.btn-delete-submission:active {
  transform: translateY(1px);
  background: rgba(255, 111, 105, 0.25);
  border-color: var(--red);
}

.btn-delete-submission:disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* Confirm Dialog */

.confirm-dialog {
  width: 280px;
  background: var(--popup-bg);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 24px 20px 16px;
  text-align: center;
  margin-top: 40vh;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.confirm-dialog p {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.4;
}

.confirm-actions {
  display: flex;
  gap: 8px;
}

.btn-confirm {
  flex: 1;
  min-height: 40px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
}

.btn-confirm.cancel {
  background: var(--btn-ghost);
  color: var(--text-dim);
}

.btn-confirm.ok {
  background: var(--red);
  color: white;
}

.btn-confirm:active {
  transform: translateY(1px);
}

/* Suggest Button */

.btn-suggest {
  width: 100%;
  min-height: 44px;
  padding: 12px;
  margin-top: 12px;
  border: 2px solid var(--border-dark);
  border-radius: 8px;
  background: var(--btn-primary);
  color: white;
  font-size: 14px;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 0 rgba(0, 0, 0, 0.25);
}

.btn-suggest:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.25);
}

/* Footer / Device ID */

footer {
  padding: 16px 0 4px;
}

.device-id-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid rgba(229, 181, 79, 0.3);
  border-radius: 8px;
  font-size: 10px;
}

.device-id-label {
  color: var(--text-dim);
  font-weight: 800;
  white-space: nowrap;
  text-transform: uppercase;
}

#device-id-value {
  flex: 1;
  color: var(--text-dim);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
  -webkit-user-select: all;
}

.btn-copy {
  padding: 4px 8px;
  border: 1px solid var(--border-gold);
  border-radius: 4px;
  background: var(--surface);
  color: var(--gold-bright);
  font-size: 10px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  text-transform: uppercase;
}

.btn-copy:active {
  transform: translateY(1px);
}

/* Popup */

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.popup-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.popup {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--popup-bg);
  border-bottom: 2px solid var(--border-gold);
  border-radius: 0 0 12px 12px;
  padding: 20px 16px;
  padding-top: max(20px, env(safe-area-inset-top));
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.popup-overlay.open .popup {
  transform: translateY(0);
}

.popup h2 {
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  margin-bottom: 4px;
  color: var(--gold-bright);
}

.popup-desc {
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.5;
}

.btn-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  background: var(--surface);
  color: var(--gold-bright);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

textarea,
input[type="email"] {
  user-select: text;
  -webkit-user-select: text;
}

textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  font-weight: 650;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}

textarea:focus {
  border-color: var(--gold);
}

textarea::placeholder {
  color: var(--text-dim);
  font-weight: 700;
}

input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  font-weight: 650;
  outline: none;
  transition: border-color 0.15s;
}

input[type="email"]:focus {
  border-color: var(--gold);
}

input[type="email"]::placeholder {
  color: var(--text-dim);
  font-weight: 700;
}

.btn-submit {
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border: 2px solid var(--border-dark);
  border-radius: 8px;
  background: var(--btn-primary);
  color: white;
  font-size: 14px;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 0 rgba(0, 0, 0, 0.25);
}

.btn-submit:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.25);
}

.btn-submit:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.form-msg {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  min-height: 16px;
}

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

.form-msg.error {
  color: var(--red);
}
