/* The island: NotchShape (a body inset by the ears, quad-curved ears flaring at the top
   corners), morphing between closed, tracker, alert and open on NotchetStyle.motion. */

.island {
  --w: 212px;
  --h: 32px;
  --ear: 6px;
  --radius: 8px;
  --motion: cubic-bezier(.3, 1.05, .4, 1);
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 10;
  width: var(--w);
  height: var(--h);
  transform: translateX(-50%) scale(var(--scale, 1));
  transform-origin: 50% 0;
  transition: width .3s var(--motion), height .3s var(--motion), transform .3s var(--motion);
}

.island .body {
  position: absolute;
  inset: 0 var(--ear);
  background: #000;
  border: 1px solid transparent;
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  transition: border-radius .3s var(--motion), inset .3s var(--motion), border-color .3s, box-shadow .3s;
}
/* The ears: black outside a quarter circle centered on the ear's lower outer corner. */
.island .body::before,
.island .body::after {
  content: "";
  position: absolute;
  top: 0;
  width: var(--ear);
  height: var(--ear);
}
.island .body::before { left: calc(-1 * var(--ear) - 1px); background: radial-gradient(circle at 0 100%, transparent calc(var(--ear) - .5px), #000 var(--ear)); }
.island .body::after { right: calc(-1 * var(--ear) - 1px); background: radial-gradient(circle at 100% 100%, transparent calc(var(--ear) - .5px), #000 var(--ear)); }

/* The edge highlight and shadow only on raised states; closed blends into the notch. */
.island.is-alert .body,
.island.is-open .body { border-color: var(--hairline); box-shadow: 0 4px 10px rgba(0, 0, 0, .5); }

.island .band { position: absolute; top: 0; left: 0; right: 0; height: 32px; }
.island .dots { position: absolute; top: 18px; right: 20px; display: flex; gap: 5px; opacity: 0; transition: opacity .2s; }
.island.is-open .dots { opacity: 1; }
/* PageDots: 5pt circles 5pt apart; the hit area reaches 3pt past each. */
.island .dot { position: relative; width: 5px; height: 5px; padding: 0; border: 0; border-radius: 50%; background: var(--unlit); cursor: pointer; transition: background .2s; }
.island .dot::before { content: ""; position: absolute; inset: -3px; }
.island .dot.on { background: var(--accent); }
.island .dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Content fades with a 4px slide, instead of a phone's scale-and-bounce. */
.island .layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.island.is-tracker .layer.tracker,
.island.is-alert .layer.alert,
.island.is-open .layer.rack { opacity: 1; transform: none; pointer-events: auto; transition-delay: .08s; }

.island .layer.tracker { display: flex; align-items: center; }
.island .layer.alert { padding: 38px 14px 12px; }
.island .layer.rack { padding: 50px 20px 26px; overflow: hidden; }
.island .row { display: flex; justify-content: center; align-items: flex-start; gap: 60px; height: 112px; }

.island .slot { position: relative; flex: none; }
.island .slot[hidden] { display: none !important; }
/* The hero's focus: a soft accent glow behind the widget the headline names. */
.island .slot::before {
  content: "";
  position: absolute;
  inset: -14px -18px;
  border-radius: 14px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 14%, transparent), transparent);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}
.island .slot.focused::before { opacity: 1; }
.island.editing .slot.focused::before { opacity: 0; }

.island.reduced,
.island.reduced .body { transition: none; }
.island.reduced .layer { transform: none; transition: opacity .2s ease; }
@media (prefers-reduced-motion: reduce) {
  .island, .island .body { transition: none; }
  .island .layer { transform: none; transition: opacity .2s ease; }
}

/* ---- Trackers: [left wing | notch | right wing] at notch height ---- */
.island .wing { height: 32px; display: flex; align-items: center; justify-content: center; }
.island .wing.left { padding: 0 4px 0 6px; }
.island .wing.right { padding: 0 6px 0 4px; }
.island .notch-gap { flex: none; }
.island .wing-text { font: 600 12px/1 var(--mono); color: var(--t1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.island .wing-text.accent { color: var(--accent); }
.island .wing-text.urgent { color: var(--urgent); }
.island .wing-text.infinity { font-family: -apple-system, system-ui, sans-serif; font-weight: 700; }
.island .spinner { font: 600 14px/1 -apple-system, system-ui, sans-serif; color: var(--claude); }
.island .mini-cover { width: 18px; height: 18px; border-radius: 4px; background: linear-gradient(160deg, var(--a), var(--b) 70%); }
.island .mini-cover.paused { opacity: .6; }
.island .bars { display: flex; align-items: center; gap: 2px; height: 14px; }
.island .bars span { width: 2.5px; height: 5px; border-radius: 1px; background: var(--accent); transition: height .18s var(--motion); }
.island .beat-light { width: 8px; height: 8px; border-radius: 1.5px; background: color-mix(in srgb, var(--accent) 20%, transparent); }
.island .beat-light.lit { background: color-mix(in srgb, var(--accent) 75%, transparent); box-shadow: 0 0 3px color-mix(in srgb, var(--accent) 60%, transparent); }
.island .beat-light.lit.down { background: var(--accent); }
.island .cup { color: var(--accent); display: grid; }

/* ---- Alerts ---- */
.island .alert-row { display: flex; align-items: center; gap: 12px; }
.island .alert-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.island .lbl.urgent { color: var(--urgent); }
.island .lbl.primary { color: var(--t1); }
.island .alert-done { font: 600 24px/1.2 var(--mono); letter-spacing: 2px; color: var(--accent); text-transform: uppercase; }
.island .alert-title { font: 600 16px/1.2 var(--mono); color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.island .timer-alert { display: flex; flex-direction: column; gap: 8px; }
.island .timer-alert .fuse.flash { animation: fuse-flash .36s steps(1) 3; }
@keyframes fuse-flash { 0% { opacity: .15; } 50% { opacity: 1; } }
.island .claude-alert { display: flex; flex-direction: column; gap: 5px; }
.island .claude-alert .alert-head { display: flex; gap: 6px; }
.island .alert-request { font: 500 11px/1.3 var(--mono); color: var(--t1); }
.island .claude-alert .alert-row { margin-top: auto; gap: 8px; }
.island .claude-alert .fuse { flex: 1; }
.island .claude-alert .fuse.burn span { animation: burn 60s linear forwards; }
@keyframes burn { from { width: 100%; } to { width: 0; } }
.island .key.guarded { opacity: .4; }

/* ---- Edit mode (EditableModule): dimmed content, an accent frame 6pt out with corner screws
   and a grip tab, and a 1U/2U size key on the frame's top-right corner ---- */
.island.editing .slot { cursor: grab; touch-action: none; }
.island.editing .slot > :not(.module):not(.size-key) { opacity: .35; pointer-events: none; }
.island.editing .slot:focus-visible { outline: none; }
.island.editing .slot:focus-visible .module { box-shadow: 0 0 0 2px var(--accent); }
.island .module {
  position: absolute; inset: -6px; border: 1px solid color-mix(in srgb, var(--accent) 80%, transparent); border-radius: 6px; pointer-events: none;
  --screw: radial-gradient(circle, color-mix(in srgb, var(--accent) 60%, transparent) 1px, transparent 1.2px);
  background: var(--screw) 3px 3px / 2px 2px no-repeat, var(--screw) calc(100% - 3px) 3px / 2px 2px no-repeat,
              var(--screw) 3px calc(100% - 3px) / 2px 2px no-repeat, var(--screw) calc(100% - 3px) calc(100% - 3px) / 2px 2px no-repeat;
}
.island .module::before { content: "≡"; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 0 6px; border-radius: 9px; background: #000; color: var(--accent); font: 700 11px/12px -apple-system, system-ui, sans-serif; }
.island .size-key {
  position: absolute; top: -15px; right: -15px; z-index: 2; height: 18px; padding: 0 5px; border-radius: 9px;
  font: 700 9px/16px var(--mono); color: var(--accent); background: var(--key-pressed); border: 1px solid color-mix(in srgb, var(--accent) 80%, transparent); cursor: pointer;
}
.island .size-key::before { content: ""; position: absolute; inset: -5px; }
.island .size-key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.island .slot.socket { opacity: .2; }
.island .ghost { position: absolute; z-index: 6; pointer-events: none; cursor: grabbing; }
.island .dot.target { transform: scale(1.8); background: var(--accent); }
.island.editing .layer.rack { overflow: visible; }

/* ---- Ticker tape (TickerTapeView): 14pt in the bottom band, 6pt up, fading at both ends ---- */
.island .tape {
  position: absolute; left: 20px; right: 20px; bottom: 6px; height: 14px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.island .tape[hidden] { display: none; }
.island .tape-track { display: flex; width: max-content; will-change: transform; }
.island .tape-row { display: flex; gap: 18px; padding-right: 18px; }
.island .quote { display: flex; gap: 4px; font: 500 10px/14px var(--mono); white-space: nowrap; }
.island .quote .sym { color: var(--t1); }
.island .quote .px { color: var(--t2); }
.island .quote .up { color: #3ee07a; }
.island .quote .down { color: #ff4d2e; }
.island .spinner.braille { font-size: 20px; }
.island .dots3 { display: flex; gap: 3px; }
.island .dots3 span { width: 4.5px; height: 4.5px; border-radius: 50%; background: rgb(82, 82, 82); }
.island .dots3 span.on { background: rgb(242, 242, 242); }
.island .bell { color: var(--accent); display: grid; }
.island .claude-alert .alert-row .key { flex: none; }

/* Edit header (EditHeader) and the library */
.island .edit-header { position: absolute; inset: 0 20px; display: flex; align-items: center; gap: 8px; }
.island .edit-header .lbl { margin-right: auto; }
.island.editing .dots { right: 82px; }
.island .edit-header .key { height: 20px; font-size: 10px; }
.island .library {
  position: absolute; inset: 44px 16px 12px; z-index: 7; padding: 10px; border-radius: 10px;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px;
  background: var(--tray, #161616); border: 1px solid var(--hairline);
}

/* The widget the edit keys act on */
.island.editing .slot.selected { outline: 2px solid var(--tint, #c8ff3d); outline-offset: 3px; border-radius: 6px; }
/* Phones add from the full-size + Add under the tabs */
html.island-scaled .island .edit-header [data-open-library] { display: none; }
