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

:root {
  --bg: #0a0a0c;
  --surface: #151518;
  --surface-hover: #1c1c20;
  --border: #2a2a2f;
  --text: #e8e8ec;
  --text-secondary: #8a8a94;
  --accent: #34c759;
  --accent-dim: rgba(52, 199, 89, 0.15);
  --vote-active: #34c759;
  --vote-down: #ff453a;
  --btn-bg: #1e1e24;
  --btn-hover: #28282f;
  --popup-bg: #131316;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  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 16px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 24px 0 16px;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

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

.request-card {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border-radius: 12px;
  padding: 14px;
  transition: background 0.15s;
}

.request-card:hover {
  background: var(--surface-hover);
}

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

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

.vote-btn:hover {
  background: var(--btn-bg);
}

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

.vote-btn.down.active {
  color: var(--vote-down);
  background: rgba(255, 69, 58, 0.15);
}

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

.vote-count {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  padding: 2px 0;
}

.request-content {
  flex: 1;
  min-width: 0;
}

.request-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.request-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.badge-implemented {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

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

.empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 48px 0;
  font-size: 15px;
}

.btn-suggest {
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-suggest:hover {
  background: var(--surface-hover);
}

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

footer {
  padding: 24px 0 8px;
}

.device-id-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 10px;
  font-size: 12px;
}

.device-id-label {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

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

.btn-copy {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

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

/* Popup */

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

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

.popup {
  width: 100%;
  max-width: 480px;
  background: var(--popup-bg);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

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

.popup h2 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.popup-desc {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.4;
}

.btn-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--btn-bg);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup {
  position: relative;
}

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

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

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

textarea:focus {
  border-color: #4a4a55;
}

textarea::placeholder {
  color: var(--text-secondary);
}

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

input[type="email"]:focus {
  border-color: #4a4a55;
}

input[type="email"]::placeholder {
  color: var(--text-secondary);
}

.btn-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-submit:hover {
  opacity: 0.9;
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

.form-msg {
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}

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

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

.request-content {
  user-select: text;
  -webkit-user-select: text;
}
