:root {
  color-scheme: light;
  --bg: #f5d8b2;
  --surface: rgba(255, 250, 239, .64);
  --line: rgba(255, 255, 255, .68);
  --muted: #79604c;
  --accent: #b84908;
  --ink: #382719;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  background: radial-gradient(ellipse at 8% 12%, #ff963f 0, transparent 44%), radial-gradient(ellipse at 95% 85%, #ffad52 0, transparent 42%), linear-gradient(130deg, #f4c89f, #fae8ca 53%, #edcba7);
  background-attachment: fixed;
  isolation: isolate;
  padding: 32px 24px;
}
/* Vector artwork stays crisp at any screen resolution. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url('/orange-waves.svg') center / cover no-repeat;
}
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #a94206; outline-offset: 4px; }
header, main, dialog, .card, .login-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 18px 60px rgba(122, 64, 19, .07);
}
header {
  max-width: 1120px;
  margin: auto;
  padding: 18px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-radius: 22px;
  background: rgba(255, 244, 224, .48);
}
.brand { font-weight: 800; letter-spacing: -1px; font-size: 24px; }
.brand span { color: #e96912; display: inline-block; margin-left: 4px; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.chip { font-size: 12px; font-weight: 600; color: #82522e; border: 1px solid rgba(180, 103, 37, .16); border-radius: 30px; padding: 7px 13px; background: rgba(255, 248, 232, .5); }
main { max-width: 720px; padding: 40px; margin: 32px auto 16px; border-radius: 32px; background: rgba(255, 245, 226, .42); }
.profile { text-align: center; margin-bottom: 34px; padding: 6px 0 28px; border-bottom: 1px solid rgba(150, 97, 48, .12); }
.avatar { width: 84px; height: 84px; background: linear-gradient(140deg, #ffb444, #f17520); color: #fff9ec; font-size: 32px; font-weight: 750; display: grid; place-items: center; margin: 0 auto 22px; border: 1px solid rgba(255,255,255,.8); border-radius: 27px; transform: rotate(-6deg); box-shadow: inset 0 2px 3px #ffffff65, 0 12px 26px #cc691b30, 5px 5px 0 #ffffff60; }
.avatar span { transform: rotate(6deg); }
h1 { font-size: 34px; line-height: 1.2; margin: 0 0 10px; letter-spacing: -1.2px; font-weight: 750; }
.profile p { color: var(--muted); margin: 0; font-size: 15px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.toolbar h2 { font-size: 14px; font-weight: 650; margin: 0; color: var(--muted); }
button { border: 1px solid rgba(255,255,255,.8); background: rgba(255, 250, 239, .7); color: #694124; border-radius: 12px; padding: 10px 15px; min-height: 42px; font-size: 14px; font-weight: 650; box-shadow: 0 3px 10px #96551608; transition: background .2s, transform .2s, box-shadow .2s; }
button:hover { background: #fff8e9; box-shadow: 0 5px 16px #96551616; }
button:active { transform: scale(.98); }
.primary { color: #fff; background: linear-gradient(135deg, #ce580b, #b74407); border-color: #ffffff50; box-shadow: inset 0 1px 0 #ffffff40, 0 6px 18px #c65b1729; }
.primary:hover { background: linear-gradient(135deg, #ba4907, #9f3705); }
#links { display: grid; gap: 12px; }
.card { display: flex; align-items: center; gap: 16px; border-radius: 19px; padding: 18px; transition: transform .2s, background .2s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); background: rgba(255, 253, 247, .86); box-shadow: 0 10px 24px #9f591314; }
.icon { flex-shrink: 0; width: 46px; height: 46px; background: linear-gradient(140deg, #ffe7ba, #ffd294); color: #a6490c; border: 1px solid #ffffffa8; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 20px; }
.link { color: inherit; text-decoration: none; flex: 1; min-width: 0; }
.title { display: block; font-weight: 650; overflow-wrap: anywhere; }
.domain { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; margin-top: 3px; }
.actions { display: flex; gap: 6px; }
.actions button { padding: 8px 10px; font-size: 13px; }
.delete { color: #ab3421; background: #fff0e9; border-color: #e9b7a8; }
footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 30px; }
.empty { text-align: center; padding: 44px 24px; border: 1px dashed #c48b5080; border-radius: 19px; background: #fff8e94d; }
.empty p { color: var(--muted); margin: 8px 0 0; font-size: 14px; }
.empty strong { font-size: 19px; }
.manage { margin-top: 22px; display: flex; justify-content: center; }
#mode[aria-pressed='true'] { background: #ffdda7; border-color: #d58642; }
dialog { width: calc(100% - 32px); max-width: 450px; padding: 28px; background: rgba(255, 246, 229, .94); color: var(--ink); border-radius: 24px; box-shadow: 0 25px 90px #64340840; }
dialog::backdrop { background: #6b351f45; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
dialog h2 { font-size: 24px; margin: 0 0 22px; letter-spacing: -.5px; }
label { display: block; font-size: 14px; font-weight: 550; margin-bottom: 8px; color: #66462e; }
input { width: 100%; padding: 12px 14px; color: var(--ink); background: #fffcf5bb; border: 1px solid #bc8a554d; border-radius: 12px; margin-bottom: 18px; box-shadow: inset 0 2px 4px #9b612006; }
input::placeholder { color: #89715b; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
#error, #loadError { color: #a32e1c; font-size: 14px; }
#error { margin: 0 0 12px; }
#loadError { text-align: center; }
#loadError:empty { display: none; }
#toast { position: fixed; z-index: 10; bottom: 22px; left: 50%; transform: translateX(-50%); background: #fff6e8ed; color: #674022; border: 1px solid white; backdrop-filter: blur(18px); padding: 12px 20px; border-radius: 14px; max-width: calc(100% - 32px); width: max-content; box-shadow: 0 8px 35px #88501630; font-size: 14px; }
#toast:empty { display: none; }
.note { font-size: 14px; color: var(--muted); }
.login-panel { border-radius: 22px; padding: 28px; }
.login-panel h2 { margin: 0 0 22px; font-size: 20px; letter-spacing: -.5px; }
.login-panel button { width: 100%; }
button:disabled { opacity: .55; cursor: wait; }
.retry { margin: 0 auto 16px; display: block; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  body { padding: 16px 12px; }
  header { padding: 14px 16px; border-radius: 18px; }
  .brand { font-size: 21px; }
  main { padding: 28px 18px; margin-top: 20px; border-radius: 26px; }
  .header-actions { gap: 8px; }
  .chip { font-size: 11px; padding: 6px 9px; }
  .card { gap: 12px; padding: 14px; }
  .actions { flex-direction: column; }
  .actions button { padding: 6px 9px; }
  h1 { font-size: 28px; }
  .login-panel { padding: 22px 18px; }
  .toolbar { gap: 8px; }
  .toolbar h2 { font-size: 13px; }
}
@media (max-width: 380px) { .header-actions .chip { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

/* A separate light layer preserves the glass and button colors. */
button, .card, .login-panel, .empty {
  position: relative;
  isolation: isolate;
}
button::after, .card::after, .login-panel::after, .empty::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle 150px at var(--light-x, 50%) var(--light-y, 50%), rgba(255, 255, 255, .58), rgba(255, 216, 151, .18) 45%, transparent 75%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
  transition: opacity .24s ease;
  z-index: -1;
}
button::after { z-index: 0; background: radial-gradient(circle 90px at var(--light-x, 50%) var(--light-y, 50%), #ffffff38, transparent 75%); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .light-active::after { opacity: 1; }
}

/* Icon library and image cropper */
#editor { max-width: 560px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.icon img { display: block; width: 30px; height: 30px; object-fit: contain; }
.icon.custom-image { overflow: hidden; }
.icon.custom-image img { width: 100%; height: 100%; object-fit: cover; }
.icon-picker { margin: 4px 0 20px; padding: 0; border: 0; min-width: 0; }
.icon-picker legend { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.icon-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.icon-choice { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; padding: 10px 4px; font-size: 10px; line-height: 1.3; min-width: 0; }
.icon-choice .icon { width: 34px; height: 34px; font-size: 20px; border: 0; background: transparent; }
.icon-choice[aria-pressed='true'] { background: #ffe0b3; border-color: #ac4c0b; box-shadow: inset 0 0 0 1px #ac4c0b; }
.custom-icon-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.custom-icon-row .note { font-size: 11px; margin: 6px 0 0; }
#cropDialog { max-width: 430px; max-height: calc(100dvh - 24px); overflow-y: auto; }
#cropDialog h2 { margin-bottom: 8px; }
#cropCanvas { display: block; width: min(100%, 280px); height: auto; aspect-ratio: 1; margin: 18px auto; border-radius: 16px; border: 2px solid #fff; box-shadow: 0 0 0 1px #cd9656; cursor: grab; touch-action: none; }
#cropCanvas:active { cursor: grabbing; }
#cropCanvas:focus-visible { outline: 3px solid #a94206; outline-offset: 4px; }
#cropZoom { padding: 0; accent-color: #bc5009; box-shadow: none; min-height: 32px; margin-bottom: 8px; }
.crop-preview-row { display: flex; align-items: center; gap: 12px; }
#cropPreview { border-radius: 13px; border: 1px solid #fff; }
.crop-preview-row button { margin-left: auto; font-size: 12px; }
#cropError { color: #a32e1c; font-size: 14px; }
@media(max-width: 380px) { .icon-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); } #editor, #cropDialog { padding: 20px; } }

/* Named collections and always-visible copy action. */
#links { gap: 30px; }
.group-links { display: grid; gap: 12px; }
.group-title { text-align: center; font-size: 18px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; margin: 4px 0 16px; color: var(--ink); }
.group-hint { margin: -10px 0 20px; font-size: 12px; }
.actions { flex-shrink: 0; align-items: center; }
.actions .copy-link { display: grid; place-items: center; padding: 10px; width: 42px; min-height: 42px; }
.copy-glyph { display: block; position: relative; width: 15px; height: 17px; border: 1.7px solid currentColor; border-radius: 3px; margin: 3px 0 0 3px; }
.copy-glyph::before { content: ''; position: absolute; width: 10px; height: 12px; left: -5px; top: -5px; border-top: 1.7px solid currentColor; border-left: 1.7px solid currentColor; border-radius: 3px 0 0 0; }
@media(max-width: 600px) { .group-title { font-size: 16px; } .actions .copy-link { width: 42px; min-height: 42px; } }

.brand img { display: block; width: 178px; height: auto; }
@media(max-width:600px) { .brand img { width: 145px; } }
