/* UI theme. Rules: docs/project-control/ui-theme-system-v1.md
   A theme recolours window title bars and places soft art on the right of the
   listed window bodies. The page floor background stays with 背景設定. */

/* Title bars keep the RO light-to-dark gradient in the heroine's colour. */
:root[data-ui-theme]:not([data-ui-theme='default']) #game .titlebar {
  background: linear-gradient(var(--ui-theme-bar-top), var(--ui-theme-bar-bottom));
}

:root[data-ui-theme]:not([data-ui-theme='default']) #game .window {
  border-color: var(--ui-theme-bar-border);
}

/* Light surfaces: 基本訊息, 對話欄, 掛機, 系統. Text sits on the left under a
   strong white veil; the art only shows through on the right. */
:root[data-ui-theme]:not([data-ui-theme='default'])
  :is(#game > .social-window,
    #hunt > .window:not(.map-window, .combat-window), #system > .window) {
  background-color: #fff;
  background-image:
    linear-gradient(90deg, rgb(255 255 255 / 94%) 0%, rgb(255 255 255 / 90%) 42%,
      rgb(255 255 255 / 50%) 100%),
    var(--ui-theme-panel),
    url('/ro/client/skin/default/sysbox_bg.png');
  background-repeat: no-repeat, no-repeat, repeat;
  background-position: 0 0, right top, 0 0;
  background-size: 100% 100%, auto max(100%, 340px), auto;
}

:root[data-ui-theme]:not([data-ui-theme='default']) #game > .social-window .chat-feed {
  background: transparent;
}

/* Chat lines run the full width, so a soft white halo keeps text legible where
   it crosses the art on the right. */
:root[data-ui-theme]:not([data-ui-theme='default']) #game > .social-window .chat-line {
  text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 4px rgb(255 255 255 / 85%);
}

/* Log surface: 戰鬥終端 stays dark; the art is dimmer and pushed right. */
:root[data-ui-theme]:not([data-ui-theme='default']) .combat-window .console {
  background-color: #030603;
  background-image:
    linear-gradient(90deg, rgb(3 6 3 / 97%) 0%, rgb(3 6 3 / 93%) 50%, rgb(3 6 3 / 60%) 100%),
    var(--ui-theme-panel);
  background-repeat: no-repeat;
  background-position: 0 0, right center;
  background-size: 100% 100%, auto 100%;
}

:root[data-ui-theme]:not([data-ui-theme='default']) .combat-window .console .event {
  text-shadow: 0 1px 2px #000;
}

:root[data-ui-theme]:not([data-ui-theme='default']) .combat-window .console .event small {
  color: #7f8f85;
}

@media (max-width: 700px) {
  :root[data-ui-theme]:not([data-ui-theme='default'])
    :is(#game > .social-window,
      #hunt > .window:not(.map-window, .combat-window), #system > .window) {
    background-image:
      linear-gradient(90deg, rgb(255 255 255 / 94%) 0%, rgb(255 255 255 / 90%) 30%,
        rgb(255 255 255 / 28%) 100%),
      var(--ui-theme-panel),
      url('/ro/client/skin/default/sysbox_bg.png');
    background-size: 100% 100%, auto max(100%, 320px), auto;
  }

  :root[data-ui-theme]:not([data-ui-theme='default']) .combat-window .console {
    background-image:
      linear-gradient(90deg, rgb(3 6 3 / 97%) 0%, rgb(3 6 3 / 90%) 35%, rgb(3 6 3 / 45%) 100%),
      var(--ui-theme-panel);
  }
}

/* Settings selector */
.ui-theme-settings {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.ui-theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}

.ui-theme-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 3px;
  border: 1px solid #8e9ba8;
  border-top: 5px solid var(--ui-theme-card-bottom, #546d8b);
  border-radius: 2px;
  background: #fff;
  color: #1d2934;
  cursor: pointer;
  text-align: center;
}

.ui-theme-card.is-selected {
  border-color: #1d2934;
  box-shadow: 0 0 0 1px #1d2934;
}

.ui-theme-card:focus-visible {
  outline: 2px solid #315d89;
  outline-offset: 1px;
}

.ui-theme-card:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.ui-theme-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
}

.ui-theme-card[data-theme-id='default'] .ui-theme-thumb {
  background:
    linear-gradient(#9bb0c9, #546d8b) 0 0 / 100% 24% no-repeat,
    url('/ro/client/skin/default/sysbox_bg.png') 0 0 / auto repeat,
    #fff;
  box-shadow: inset 0 0 0 1px #273a51;
}

.ui-theme-label {
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.3;
}

.ui-theme-status {
  color: #7a4b14;
}
