/* Scenes tab (tap-to-run cards, automatic list) and the If → Then editor. Tokens come from app.css. */

/* scene colours: [from, to] of each card gradient — readable white text in light and dark themes */
.c-blue { --sc-a: #2F6DB5; --sc-b: #4F92E3; }
.c-amber { --sc-a: #C8641F; --sc-b: #EE9445; }
.c-green { --sc-a: #17845A; --sc-b: #33B47E; }
.c-violet { --sc-a: #5F43B8; --sc-b: #8C6FE4; }
.c-rose { --sc-a: #B83B60; --sc-b: #E56A8D; }
.c-teal { --sc-a: #0F7C82; --sc-b: #27ABA8; }
.c-slate { --sc-a: #3B4759; --sc-b: #5F6D82; }

.scene-tabs { margin: 0 0 16px; }

/* ---------- tap-to-run grid ---------- */
.scene-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .scene-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.scene-card {
  position: relative; min-height: 132px; padding: 14px; border-radius: 20px; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; color: #fff;
  background: linear-gradient(145deg, var(--sc-a), var(--sc-b));
  box-shadow: 0 10px 24px -14px var(--sc-a);
  transition: transform .18s var(--ease);
}
.scene-card:active { transform: scale(.97); }
.scene-run { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; border-radius: inherit; z-index: 1; }
.scene-run:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
.scene-card .sc-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .2); margin-bottom: auto; }
.scene-card .sc-ic svg { width: 22px; height: 22px; }
.scene-card .sc-name { font-weight: 700; font-size: 16px; line-height: 1.3; margin-top: 18px; }
.scene-card .sc-sub { font-size: 12.5px; opacity: .85; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.scene-card .sc-edit {
  position: absolute; top: 8px; inset-inline-end: 8px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer;
}
.scene-card .sc-edit svg { width: 18px; height: 18px; }
/* run feedback: a light wave across the card */
.scene-card::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .45), transparent 60%);
}
.scene-card.running::after { animation: sc-pulse .6s var(--ease); }
@keyframes sc-pulse { from { opacity: 1; transform: scale(.3); } to { opacity: 0; transform: scale(1.6); } }

/* ---------- automatic list ---------- */
.auto-list { display: grid; gap: 10px; }
.auto-card { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--r-group); background: var(--surface); box-shadow: var(--shadow-1); transition: opacity .2s; }
.auto-card.off .auto-main { opacity: .55; }
.auto-main { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; text-align: start; color: inherit; font: inherit; cursor: pointer; display: grid; gap: 6px; }
.auto-head { display: flex; align-items: center; gap: 10px; }
.auto-head .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.auto-head .ic svg { width: 18px; height: 18px; }
.auto-head .title { font-weight: 600; font-size: 16px; }
.auto-line { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--ink-2); min-width: 0; }
.auto-line > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auto-card .sub { font-size: 12.5px; color: var(--ink-3); }

.tag { display: inline-block; flex: none; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; line-height: 1.5; }
.tag.if { background: var(--accent-soft); color: var(--accent); }
.tag.then { background: var(--fill); color: var(--ink); }

/* ---------- editor ---------- */
.editor-name { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.editor-name .input { flex: 1; font-size: 17px; font-weight: 600; }
.scene-ic { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--sc-a), var(--sc-b)); }
.scene-ic svg { width: 24px; height: 24px; }
details.look { margin-bottom: 16px; }
details.look summary { cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 500; padding: 6px 0; list-style: none; }
details.look summary::-webkit-details-marker { display: none; }
.look-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.look-ic { width: 44px; height: 44px; border-radius: 12px; border: 0; display: grid; place-items: center; background: var(--fill); color: var(--ink-2); cursor: pointer; }
.look-ic svg { width: 22px; height: 22px; }
.look-ic.on { background: var(--accent); color: var(--on-accent); }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; background: linear-gradient(145deg, var(--sc-a), var(--sc-b)); }
.swatch.on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--sc-a); }

.editor-block { margin-bottom: 18px; }
.editor-block h3 { margin: 0 0 10px; font-size: 15px; }
.editor-block h3 .tag { font-size: 14px; padding: 3px 12px; }
.match { margin-bottom: 10px; }
.step { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 14px; padding: 4px 6px 4px 4px; margin-bottom: 8px; }
.step-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 8px; text-align: start; color: inherit; font: inherit; font-size: 15px; cursor: pointer; border-radius: 10px; }
.step-main .ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.step-main .ic svg { width: 18px; height: 18px; }
.btn.icon.sm { width: 36px; min-height: 36px; color: var(--ink-3); }
.btn.icon.sm svg { width: 18px; height: 18px; }
.btn.icon.sm .up { transform: rotate(-90deg); }
[dir="rtl"] .btn.icon.sm .up { transform: rotate(-90deg) scaleY(-1); }
.add-step {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 14px;
  border: 1.5px dashed var(--line); background: transparent; color: var(--accent); font: inherit; font-weight: 500; cursor: pointer;
}
.add-step svg { width: 18px; height: 18px; }
.window { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.window-head { display: flex; align-items: center; gap: 10px; }
.window-head .title { display: block; font-weight: 500; }
.window-head .sub { display: block; font-size: 13px; color: var(--ink-3); }
.window .two { margin-top: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.step-config { display: grid; gap: 4px; margin-bottom: 12px; }
.group.flat { background: var(--surface-2); box-shadow: none; }
.editor-block .hint { font-size: 13px; color: var(--ink-3); margin: 0 0 10px; line-height: 1.5; }
