:root {
  --primary: #7546e8;
  --primary-dark: #5930c0;
  --text: #282139;
  --muted: #7b728c;
  --border: #ece6f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(
      ellipse at top right,
      #eae0ff 0,
      transparent 48%
    ),
    #f8f7fc;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

main {
  width: min(100%, 1000px);
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* Navigation */

nav {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 6px;
  margin-bottom: 42px;
  background: #ffffffd9;
  border: 1px solid #fff;
  border-radius: 18px;
  box-shadow: 0 5px 24px #39225f08;
}

nav a {
  padding: 10px 20px;
  border-radius: 12px;
  color: #6d617f;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 160ms, color 160ms;
}

nav a:hover {
  background: #f1ebff;
  color: var(--primary-dark);
}

body:has(#items) nav a[href="my-links.html"],
body:has(#profile) nav a[href="my-profile.html"] {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px #7546e829;
}

/* Page headings */

h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -1.5px;
}

h1::before {
  display: block;
  width: fit-content;
  margin-bottom: 18px;
  padding: 5px 12px;
  border: 1px solid #e5d9ff;
  border-radius: 8px;
  background: #efe8ff;
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  content: "WISHORA";
}

h2 {
  margin: 0 0 12px;
  font-size: 21px;
  line-height: 1.4;
  letter-spacing: -0.4px;
  overflow-wrap: anywhere;
}

main > h1 + p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 16px;
}

p {
  overflow-wrap: anywhere;
}

/* Notices */

.notice {
  margin: 20px 0;
  padding: 16px 20px;
  border: 1px solid #e8dff8;
  border-left: 3px solid #b697ef;
  border-radius: 14px;
  background: #f1ebfc;
  color: #77678c;
  font-size: 13px;
  line-height: 1.8;
}

/* Buttons */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 160ms,
    box-shadow 160ms,
    transform 160ms;
}

button:hover,
.button:hover {
  background: var(--primary-dark);
  box-shadow: 0 5px 14px #7546e824;
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

#refresh,
#more {
  border-color: #e0d5f3;
  background: #fff;
  color: var(--primary-dark);
}

#refresh:hover,
#more:hover {
  background: #f2ecff;
}

#more {
  display: flex;
  margin: 24px auto;
  min-width: 180px;
}

#status {
  min-height: 24px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

/* Link cards */

#items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 18px;
}

article,
.panel {
  min-width: 0;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 5px 22px #39225f04;
}

article {
  display: flex;
  flex-direction: column;
  transition: border-color 160ms, box-shadow 160ms;
}

article:hover {
  border-color: #d9c8f7;
  box-shadow: 0 10px 28px #5930c00a;
}

article h2 {
  font-size: 19px;
}

.muted {
  color: var(--muted);
}

article > .muted {
  margin: 0 0 24px;
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.actions button,
.actions .button {
  padding: 9px 14px;
  font-size: 12px;
}

.actions button {
  border-color: #ece5f7;
  background: #f6f2fd;
  color: var(--primary-dark);
}

.actions button:hover {
  background: #eae0fc;
}

/* Profile */

#profile {
  max-width: 680px;
  margin-top: 28px;
  padding: 32px;
}

#profile::before {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 26px;
  border: 1px solid #e6d9ff;
  border-radius: 20px;
  background: #f0e8ff;
  content: "👤";
  font-size: 27px;
}

dl {
  margin: 0;
  display: grid;
  grid-template-columns: 135px minmax(0, 1fr);
  align-items: baseline;
  gap: 0 20px;
}

dt,
dd {
  padding: 16px 0;
  border-bottom: 1px solid #f1edf7;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

#profile .notice {
  margin-bottom: 0;
}

/* Quiz details */

#details {
  margin-top: 28px;
}

#details > button {
  margin-bottom: 14px;
  background: #f3edfc;
  color: var(--primary-dark);
}

#details > h2:not(:first-child) {
  margin-top: 28px;
}

details {
  margin: 24px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fcfaff;
}

summary {
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

li {
  margin: 12px 0;
  overflow-wrap: anywhere;
}

small {
  display: block;
  color: var(--muted);
}

.table-scroll {
  overflow-x: auto;
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 15px 18px;
  text-align: left;
  border-bottom: 1px solid #f0ebf7;
}

th {
  background: #f8f5fd;
  color: #80718f;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.4px;
}

td {
  overflow-wrap: anywhere;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fcfaff;
}

[hidden] {
  display: none !important;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid #ae8bef;
  outline-offset: 4px;
}

/* Mobile */

@media (max-width: 640px) {
  main {
    padding: 20px 16px 60px;
  }

  nav {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 32px;
  }

  nav a {
    flex: 1;
    padding: 10px 6px;
    text-align: center;
    font-size: 12px;
  }

  h1 {
    letter-spacing: -1px;
  }

  #items {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  article,
  .panel,
  #profile {
    padding: 22px;
    border-radius: 18px;
  }

  .notice {
    padding: 14px 16px;
    font-size: 12px;
  }

  dl {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 0 12px;
  }

  dt {
    font-size: 12px;
  }

  dd {
    font-size: 13px;
  }

  th,
  td {
    padding: 12px;
    min-width: 90px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* Match Wishora homepage colors */

:root {
  --primary: #ec4899;
  --primary-dark: #c72f86;
  --text: #30213f;
  --muted: #756780;
  --border: #f0dff2;
}

body {
  background:
    linear-gradient(
      135deg,
      #fff0f8 0%,
      #f2e9ff 52%,
      #fff4e8 100%
    ) top / 100% 420px no-repeat,
    #fff9fd;
}

nav {
  background: rgba(255, 255, 255, 0.92);
  border-color: #f0dff2;
}

nav a {
  color: #756780;
}

nav a:hover {
  background: #fff0f8;
  color: #c72f86;
}

body:has(#items) nav a[href="my-links.html"],
body:has(#profile) nav a[href="my-profile.html"] {
  background: linear-gradient(
    135deg,
    #ec4899,
    #8b5cf6
  );
  color: white;
  box-shadow: 0 4px 14px #ec489920;
}

h1::before {
  background: #fff0f8;
  border-color: #fbd0e9;
  color: #c72f86;
}

.notice {
  background: #fff5fa;
  border-color: #f6dcec;
  border-left-color: #ec4899;
  color: #80617a;
}

button,
.button {
  background: linear-gradient(
    135deg,
    #ec4899,
    #8b5cf6
  );
}

button:hover,
.button:hover {
  background: linear-gradient(
    135deg,
    #db2777,
    #7c3aed
  );
  box-shadow: 0 5px 16px #ec489924;
}

#refresh,
#more {
  background: white;
  border-color: #f2d4e7;
  color: #c72f86;
}

#refresh:hover,
#more:hover {
  background: #fff0f8;
}

article,
.panel {
  border-color: #f0dff2;
  box-shadow: 0 5px 22px #a44d8306;
}

article:hover {
  border-color: #efbddd;
  box-shadow: 0 10px 28px #c72f860a;
}

.actions button,
#details > button {
  background: #fff0f8;
  border-color: #f6dcec;
  color: #c72f86;
}

.actions button:hover,
#details > button:hover {
  background: #fce2f1;
}

#profile::before {
  background: linear-gradient(
    135deg,
    #fff0f8,
    #f2e9ff
  );
  border-color: #f0d5ed;
}

dt,
dd {
  border-bottom-color: #f4e9f1;
}

details {
  background: #fffbfe;
  border-color: #f0dff2;
}

summary {
  color: #c72f86;
}

th {
  background: #fff3fa;
  color: #80617a;
}

th,
td {
  border-bottom-color: #f4e9f1;
}

tbody tr:hover {
  background: #fff9fd;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline-color: #8b5cf6;
}

/* Back button */

.account-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-bottom: 28px;
  padding: 9px 16px;
  border: 1px solid #f0dff2;
  border-radius: 12px;
  background: #ffffffde;
  color: #756780;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.account-back span {
  font-size: 20px;
  line-height: 1;
}

.account-back:hover {
  background: #fff0f8;
  color: #c72f86;
}

/* Space for fixed bottom navigation */

main {
  padding-bottom: calc(
    110px + env(safe-area-inset-bottom, 0px)
  );
}

/* Homepage-style bottom navigation */

.account-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;

  display: flex;
  align-items: center;
  justify-content: space-around;

  padding: 9px 4px;
  padding-bottom: max(
    9px,
    env(safe-area-inset-bottom, 0px)
  );

  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid #f0dfef;
  box-shadow: 0 -5px 25px rgba(79, 35, 83, 0.07);
}

.account-bottom-nav a {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;

  min-width: 0;
  min-height: 48px;
  max-width: 150px;
  padding: 0 2px;

  color: #806d88;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}

.account-bottom-nav a span {
  font-size: 23px;
  line-height: 1.2;
}

.account-bottom-nav a:hover,
body:has(#items)
  .account-bottom-nav a[href="my-links.html"],
body:has(#profile)
  .account-bottom-nav a[href="my-profile.html"] {
  color: #e83e87;
}

/* Move Back button and account content down */
main {
  padding-top: calc(
    44px + env(safe-area-inset-top, 0px)
  );
}
/* Individual gift deletion */
.actions .wish-delete-button { min-height: 44px; border: 1px solid #be123c; color: #9f1239; background: #fff1f2; }
html[data-theme="dark"] .actions .wish-delete-button { color: #fecdd3; background: #3b1828; border-color: #be526d; }
.actions .wish-delete-button:focus-visible { outline: 3px solid #ec4899; outline-offset: 3px; }
.actions .wish-delete-button:disabled { opacity: .6; cursor: wait; }
