:root {
  --bg: #111418;
  --card: #1b2129;
  --text: #e6e9ee;
  --muted: #97a0ad;
  --accent: #4f8cff;
  --ok: #34d399;
  --err: #f87171;
  --border: #2a323c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom);
}

main {
  max-width: 540px;
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

header h1 { margin: 0 0 .25rem; font-size: 1.5rem; }
.sub { margin: 0 0 1rem; color: var(--muted); font-size: .9rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  margin: .5rem 0 .25rem;
}

input {
  width: 100%;
  padding: .75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d1116;
  color: var(--text);
  font-size: 1rem;
}

.btn {
  width: 100%;
  padding: .85rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
}
.btn.primary { background: var(--accent); color: white; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); width: auto; margin: 0; padding: .5rem .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

#signed-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.ok { color: var(--ok); font-weight: 600; }

.status { font-size: .9rem; white-space: pre-wrap; }
.status.success { border-color: var(--ok); }
.status.error { border-color: var(--err); color: var(--err); }
.status a { color: var(--accent); }

pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .8rem;
  color: var(--muted);
  max-height: 300px;
  overflow: auto;
}
summary { cursor: pointer; color: var(--muted); }

.ios-tip {
  background: #1a2a1a;
  border: 1px solid #2d4a2d;
  border-radius: 14px;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  font-size: .85rem;
  color: var(--text);
  line-height: 1.5;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  justify-content: space-between;
}
.ios-tip a { color: var(--accent); }
.ios-tip .dismiss {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  flex-shrink: 0;
  width: auto;
  margin: 0;
}

.header-links {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .4rem;
  margin-bottom: .5rem;
}
.header-links a, .btn-link {
  color: var(--muted);
  font-size: .8rem;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: auto;
  display: inline;
  font-family: inherit;
  font-weight: normal;
}
.header-links a:hover, .btn-link:hover { color: var(--accent); }
.footer-sep { color: var(--border); font-size: .8rem; }

/* Dialog */
dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0;
  width: min(480px, 95vw);
  max-height: 85vh;
  overflow: hidden;
  color: var(--text);
  outline: none;
}
dialog::backdrop {
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
}
.dialog-inner {
  overflow-y: auto;
  max-height: 85vh;
  padding: 1.25rem;
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.dialog-header h2 { margin: 0; font-size: 1.1rem; }
#close-dialog {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 .25rem;
  line-height: 1;
}

/* Tabs */
.platform-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.tab {
  flex: 1;
  padding: .6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Steps */
.steps {
  list-style: none;
  padding: 0;
  margin: 0 0 .75rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.steps li {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  font-size: .9rem;
  line-height: 1.5;
}
.step-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 1.6rem;
  text-align: center;
}
.steps small { color: var(--muted); }
.steps code {
  font-family: monospace;
  font-size: .8rem;
  background: #0d1116;
  padding: .15rem .4rem;
  border-radius: 5px;
  display: inline-block;
  margin-top: .2rem;
  word-break: break-all;
}

.method-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.badge {
  background: var(--border);
  color: var(--muted);
  border-radius: 5px;
  padding: .1rem .4rem;
  font-size: .7rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.tip {
  background: #0d1116;
  border-radius: 10px;
  padding: .75rem;
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.5;
}

.url-row {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.url-row input { flex: 1; min-width: 0; }

.folder-row {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.folder-row select {
  flex: 1;
  min-width: 0;
}
select {
  width: 100%;
  padding: .75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d1116;
  color: var(--text);
  font-size: 1rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2397a0ad' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  padding-right: 2.2rem;
  cursor: pointer;
}
select:disabled { opacity: .5; }
.btn.icon {
  width: 2.8rem;
  padding: .75rem .5rem;
  margin: 0;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.btn.icon:active { background: var(--border); }
.btn.wide { width: 100%; margin-top: .5rem; }
#new-folder-row { margin-top: .5rem; }
