:root {
  --bg: #1a1a2e;
  --surface: #232340;
  --surface-2: #2d2d52;
  --text: #f0f0fa;
  --text-dim: #a0a0c0;
  --border: #3a3a60;
  --accent: #6c8eff;
  --danger: #e05a5a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5fa;
    --surface: #ffffff;
    --surface-2: #eeeef5;
    --text: #1a1a2e;
    --text-dim: #606080;
    --border: #d8d8e5;
    --accent: #4a6cdf;
    --danger: #c04040;
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body {
  max-width: 720px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.5px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 24px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  border-radius: 8px;
}
.icon-btn:hover {
  background: var(--surface-2);
}

#app {
  padding: 8px 16px 80px;
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty {
  text-align: center;
  color: var(--text-dim);
  margin: 48px 16px;
  font-size: 15px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 12px;
}

.skill-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.skill-card h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.delete-btn:hover {
  color: var(--danger);
  background: var(--surface-2);
}

.aspects {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.aspect {
  --temp-color: hsl(220 70% 45%);
  position: relative;
  background: var(--temp-color);
  border-radius: 10px;
  min-height: 64px;
  overflow: hidden;
}

.aspect-tap {
  width: 100%;
  height: 100%;
  min-height: inherit;
  background: transparent;
  color: white;
  border: none;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease;
}

.aspect-tap:active {
  transform: scale(0.96);
}

.aspect-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.9;
  color: white;
}

.aspect-temp {
  font-size: 18px;
  font-weight: 700;
  color: white;
  font-variant-numeric: tabular-nums;
}

.aspect.frozen {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.aspect.boiling {
  animation: boil 1.4s ease-in-out infinite;
}

@keyframes boil {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 80, 60, 0.7); }
  50%      { box-shadow: 0 0 0 4px rgba(255, 80, 60, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .aspect.boiling { animation: none; }
}

.aspect-info {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.25);
  color: white;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  line-height: 18px;
  cursor: help;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aspect-info:hover {
  background: rgba(255, 255, 255, 0.45);
}

/* info dialog */
.info-dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(380px, 92vw);
}
.info-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}
.info-dialog form {
  padding: 20px;
}
.info-dialog h2 {
  margin: 0 0 8px;
  font-size: 17px;
}
.info-dialog p {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
}
.info-dialog menu {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
}
.info-dialog menu button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.add-btn {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px dashed var(--border);
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
.add-btn:hover {
  background: var(--surface-2);
}

/* settings dialog */
.settings {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(420px, 92vw);
  max-height: 92vh;
}
.settings::backdrop {
  background: rgba(0, 0, 0, 0.5);
}
.settings form {
  padding: 20px;
}
.settings h2 {
  margin: 0 0 16px;
  font-size: 18px;
}
.settings section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.settings section:last-of-type {
  border-bottom: none;
}
.settings .label {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-dim);
}
.settings .hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}
.settings code {
  display: inline-block;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 14px;
  letter-spacing: 1px;
}
.code-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.settings input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 14px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.settings button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.settings button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.settings menu {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
}
.settings menu button {
  background: var(--surface-2);
  color: var(--text);
}
