.ak-root {
  position: relative;
  width: 100%;
  min-height: min(78vh, 760px);
  height: clamp(560px, 76vh, 820px);
  overflow: hidden;
  border: 1px solid rgba(212, 168, 67, 0.18);
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 26%, rgba(139, 92, 246, 0.16), transparent 34%),
    radial-gradient(circle at 78% 18%, rgba(212, 168, 67, 0.11), transparent 28%),
    linear-gradient(180deg, var(--bg-primary, #0a0a1a), #050511 74%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45), inset 0 0 60px rgba(212, 168, 67, 0.04);
  font-family: "Noto Sans JP", sans-serif;
  color: var(--text-primary, #e8e8f0);
  isolation: isolate;
}

.ak-root::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 8% 12%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 23% 68%, rgba(212, 168, 67, 0.45), transparent),
    radial-gradient(1px 1px at 44% 21%, rgba(255, 255, 255, 0.34), transparent),
    radial-gradient(1px 1px at 66% 74%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 86% 38%, rgba(139, 92, 246, 0.55), transparent);
  opacity: 0.9;
}

.ak-graph {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.ak-topmask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 164px;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to bottom,
    var(--bg-primary) 0%,
    rgba(10, 10, 26, 0.96) 52%,
    rgba(10, 10, 26, 0.55) 78%,
    rgba(10, 10, 26, 0) 100%);
}

.ak-loading-layer,
.ak-loading,
.ak-error {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(10, 10, 26, 0.92);
  color: rgba(245, 239, 222, 0.9);
  font-family: "Noto Serif JP", serif;
  letter-spacing: 0.08em;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.ak-loading-layer.ak-hidden {
  opacity: 0;
  visibility: hidden;
}

.ak-loading-mark {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 1px solid rgba(212, 168, 67, 0.34);
  box-shadow: 0 0 20px rgba(212, 168, 67, 0.28), inset 0 0 24px rgba(139, 92, 246, 0.18);
  animation: ak-pulse 2.4s ease-in-out infinite;
}

.ak-loading-text {
  font-size: 0.92rem;
  color: rgba(233, 222, 194, 0.88);
}

.ak-error {
  position: relative;
  min-height: 260px;
  border-radius: 16px;
  border: 1px solid rgba(212, 168, 67, 0.22);
}

.ak-topbar {
  position: absolute;
  top: 16px;
  left: 18px;
  right: 18px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(220px, 360px) auto;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.ak-brand,
.ak-search,
.ak-return,
.ak-area-chip,
.ak-panel {
  pointer-events: auto;
}

.ak-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ak-brand-kicker,
.ak-panel-kicker {
  font-family: "Cinzel", serif;
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(212, 168, 67, 0.72);
}

.ak-brand-title {
  font-family: "Cinzel", "Noto Serif JP", serif;
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(245, 239, 222, 0.95);
  text-shadow: 0 0 18px rgba(212, 168, 67, 0.28);
}

.ak-search {
  position: relative;
}

.ak-search-input {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(212, 168, 67, 0.24);
  border-radius: 999px;
  outline: none;
  background: rgba(8, 8, 22, 0.62);
  color: var(--text-primary, #e8e8f0);
  font: 500 0.86rem "Noto Sans JP", sans-serif;
  backdrop-filter: blur(12px);
  transition: border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.ak-search-input:focus {
  border-color: rgba(212, 168, 67, 0.62);
  background: rgba(14, 12, 30, 0.82);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.09);
}

.ak-search-input::placeholder {
  color: rgba(160, 160, 192, 0.78);
}

.ak-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(212, 168, 67, 0.2);
  border-radius: 12px;
  background: rgba(8, 8, 22, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.ak-suggestions:not([hidden]):not(:empty) {display:grid;}

.ak-suggestions button {
  min-height: 32px;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(245, 239, 222, 0.9);
  text-align: left;
  font: 500 0.82rem "Noto Sans JP", sans-serif;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.ak-suggestions button:hover,
.ak-suggestions button:focus-visible {
  background: rgba(212, 168, 67, 0.12);
}

.ak-return {
  justify-self: end;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(212, 168, 67, 0.28);
  border-radius: 999px;
  background: rgba(10, 10, 26, 0.64);
  color: rgba(245, 239, 222, 0.92);
  font: 600 0.78rem "Noto Sans JP", sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.18s ease;
}

.ak-return:hover {
  background: rgba(212, 168, 67, 0.14);
  border-color: rgba(212, 168, 67, 0.52);
}

.ak-return:active,
.ak-area-chip:active,
.ak-suggestions button:active,
.ak-panel-close:active {
  transform: scale(0.98);
}

.ak-area-strip {
  position: absolute;
  top: 68px;
  left: 18px;
  right: 18px;
  z-index: 3;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 168, 67, 0.34) transparent;
}

.ak-area-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(11, 11, 31, 0.54);
  color: rgba(232, 232, 240, 0.9);
  font: 600 0.76rem "Noto Sans JP", sans-serif;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.18s ease;
}

.ak-area-chip:hover {
  background: color-mix(in srgb, var(--ak-chip-color) 18%, rgba(11, 11, 31, 0.72));
  border-color: color-mix(in srgb, var(--ak-chip-color) 56%, transparent);
}

.ak-area-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ak-chip-color);
  box-shadow: 0 0 10px var(--ak-chip-color);
}

.ak-panel {
  position: absolute;
  top: 112px;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  width: min(390px, calc(100% - 36px));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(212, 168, 67, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(18, 17, 38, 0.76), rgba(7, 7, 18, 0.68));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), inset 0 18px 50px rgba(212, 168, 67, 0.035), 0 22px 70px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(22px);
  transform: translateX(calc(100% + 26px));
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.22, 0.8, 0.28, 1), opacity 0.26s ease;
}

.ak-panel.ak-open {
  transform: translateX(0);
  opacity: 1;
}

.ak-panel-grip {
  display: none;
}

.ak-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid rgba(212, 168, 67, 0.16);
}

.ak-panel-title {
  margin-top: 4px;
  font-family: "Cinzel", "Noto Serif JP", serif;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.35;
  color: rgba(245, 239, 222, 0.96);
}

.ak-panel-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(212, 168, 67, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(245, 239, 222, 0.9);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.18s ease;
}

.ak-panel-close:hover {
  background: rgba(212, 168, 67, 0.14);
  border-color: rgba(212, 168, 67, 0.5);
}

.ak-panel-body {
  overflow: auto;
  padding: 14px 18px 22px;
}

.ak-record-meta {
  margin-bottom: 14px;
  color: rgba(160, 160, 192, 0.88);
  font: 600 0.78rem "Noto Sans JP", sans-serif;
  letter-spacing: 0.04em;
}

.ak-record-section {
  margin-top: 18px;
}

.ak-record-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: rgba(212, 168, 67, 0.86);
  font: 600 0.76rem "Cinzel", "Noto Serif JP", serif;
  letter-spacing: 0.16em;
}

.ak-record-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(212, 168, 67, 0.26), transparent);
}

.ak-record-list {
  display: grid;
  gap: 9px;
}

.ak-record-card {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 10px 11px;
  border: 1px solid rgba(212, 168, 67, 0.13);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: inherit;
  text-decoration: none;
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.ak-record-card:hover,
.ak-record-card.ak-highlight {
  border-color: rgba(212, 168, 67, 0.58);
  background: rgba(212, 168, 67, 0.11);
  box-shadow: 0 0 22px rgba(212, 168, 67, 0.12);
  transform: translateY(-1px);
}

.ak-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #ffeeb2, var(--accent-gold, #d4a843));
  color: #11111e;
  font: 700 1rem "Noto Serif JP", serif;
  box-shadow: 0 0 16px rgba(212, 168, 67, 0.3);
}

.ak-bookmark {
  flex: 0 0 auto;
  width: 28px;
  height: 38px;
  border-radius: 2px 5px 5px 2px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(212, 168, 67, 0.58));
  border-left: 4px solid var(--accent-purple, #8b5cf6);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.16);
}

.ak-record-text {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.ak-record-text strong {
  color: rgba(245, 239, 222, 0.96);
  font-size: 0.9rem;
  line-height: 1.35;
}

.ak-record-text small {
  color: rgba(160, 160, 192, 0.88);
  font-size: 0.74rem;
  line-height: 1.4;
}

.ak-empty {
  padding: 18px 2px;
  color: rgba(160, 160, 192, 0.85);
  font-size: 0.84rem;
}

@keyframes ak-pulse {
  0%,
  100% {
    opacity: 0.68;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@media (max-width: 899px) {
  .ak-root {
    height: 74vh;
    min-height: 560px;
    border-radius: 14px;
  }

  .ak-topbar {
    top: 12px;
    left: 12px;
    right: 12px;
    grid-template-columns: 1fr auto;
  }

  .ak-brand {
    min-width: 0;
  }

  .ak-brand-title {
    font-size: 1rem;
  }

  .ak-brand-kicker {
    font-size: 0.55rem;
  }

  .ak-search {
    grid-column: 1 / -1;
    order: 3;
  }

  .ak-return {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.72rem;
  }

  .ak-area-strip {
    top: 104px;
    left: 12px;
    right: 12px;
  }

  .ak-topmask {
    height: 210px;
  }

  .ak-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 55vh;
    border-right: none;
    border-bottom: none;
    border-left: none;
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
  }

  .ak-panel.ak-open {
    transform: translateY(0);
  }

  .ak-panel-grip {
    display: block;
    height: 24px;
    cursor: grab;
  }

  .ak-panel-grip::before {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    margin: 10px auto 0;
    border-radius: 999px;
    background: rgba(212, 168, 67, 0.42);
  }

  .ak-panel-head {
    padding: 6px 16px 11px;
  }

  .ak-panel-body {
    padding: 12px 16px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ak-loading-mark {
    animation: none;
  }

  .ak-panel,
  .ak-return,
  .ak-area-chip,
  .ak-record-card,
  .ak-search-input {
    transition: none;
  }
}

.ak-graph {top:112px;}
.ak-root.ak-focused .ak-graph {right:calc(40% + 36px);}
.ak-root.ak-focused .ak-panel {width:40%;}
.ak-topmask {height:112px;}
.ak-suggestions[hidden], .ak-suggestions:empty {display:none;}
@media (max-width:899px) {
  .ak-graph {top:152px;}
  .ak-topmask {height:152px;}
  .ak-root.ak-focused .ak-graph {right:0;bottom:45%;}
  .ak-root.ak-focused .ak-panel {width:100%;height:45%;max-height:none;box-sizing:border-box;}
}
