/** ChallengeFlow: 08-world.css */
@layer components {
  /* Welt und Länder */
  .globe-mount {
    position: relative;
    z-index: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
  }
  .globe-mount canvas {
    position: relative;
    z-index: 0;
  }
  .globe-mount:active {
    cursor: grabbing;
  }

  .globe-fallback {
    height: 100%;
    display: grid;
    place-content: center;
    gap: 8px;
    text-align: center;
    color: #d5ddff;
    padding: 24px;
  }
  .globe-fallback strong {
    font-size: 16px;
    color: #fff;
  }
  .globe-fallback p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    max-width: 340px;
  }
  .world-fullscreen .scene-tooltip {
    font-family: inherit;
  }
  .country-overlay.open {
    transform: none;
    visibility: visible;
  }
  .country-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .country-meta-row {
    justify-content: flex-start;
    margin-bottom: 12px;
  }
  .country-list-search {
    position: relative;
    display: block;
    margin-top: 14px;
    border: 0;
    background: transparent;
  }
  .country-list-search:focus-within {
    border-color: transparent;
    box-shadow: none;
  }
  .country-list-search-icon {
    position: absolute;
    z-index: 2;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    color: var(--muted);
    pointer-events: none;
  }
  .country-list-search-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }
  .country-list-search .country-search {
    min-width: 0;
    width: 100%;
    min-height: 44px;
    padding: 0 40px 0 36px;
  }
  .country-list-search .country-search:focus {
    outline: none;
  }
  .country-search[type="search"] {
    appearance: none;
    -webkit-appearance: none;
  }
  .country-search[type="search"]::-webkit-search-decoration,
  .country-search[type="search"]::-webkit-search-cancel-button,
  .country-search[type="search"]::-webkit-search-results-button,
  .country-search[type="search"]::-webkit-search-results-decoration {
    display: none;
    -webkit-appearance: none;
  }
  .country-list-search-clear {
    position: absolute;
    z-index: 2;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
  }
  .country-list-search-clear:hover,
  .country-list-search-clear:focus-visible {
    color: var(--text);
    background: var(--soft);
    outline: none;
  }
  .country-list {
    display: grid;
    gap: 6px;
    margin-top: 12px;
  }
  .country-challenges-compact {
    display: grid;
    gap: 10px;
  }
  .country-challenge-list-item {
    display: grid;
    grid-template-columns: 124px minmax(0,1fr);
    gap: 12px;
    min-height: 108px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: border-color .18s ease,background-color .18s ease,transform .18s ease;
  }
  .country-challenge-list-item:hover,
  .country-challenge-list-item:focus-visible {
    border-color: var(--accent);
    transform: translateY(-1px);
    outline: none;
  }
  .country-challenge-thumb-wrap {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: var(--media-bg);
  }
  .country-challenge-thumb {
    display: block;
    width: 124px;
    height: 100%;
    min-height: 108px;
    max-height: 132px;
    object-fit: cover;
    object-position: center;
  }
  .country-challenge-video-thumb {
    position: relative;
    background: #17181c;
  }
  .country-challenge-video-thumb video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
  }
  .country-challenge-video-thumb .media-play-indicator {
    width: 32px;
    height: 32px;
  }
  .country-challenge-video-thumb .media-play-indicator svg {
    width: 14px;
    height: 14px;
  }
  .country-challenge-thumb-empty {
    display: grid;
    place-items: center;
    padding: 8px;
    color: var(--muted);
    font-size: 10.5px;
    text-align: center;
  }
  .country-challenge-main-label {
    position: absolute;
    left: 6px;
    bottom: 6px;
    border-radius: 0;
    padding: 3px 6px;
    background: rgba(10,10,12,.76);
    color: #fff;
    font-size: 9px;
    font-weight: 750;
    line-height: 1.2;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  .country-challenge-list-copy {
    display: grid;
    align-content: center;
    gap: 5px;
    min-width: 0;
    padding: 10px 10px 10px 0;
  }
  .country-challenge-list-copy h3,
  .country-challenge-list-copy p {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .country-challenge-list-copy h3 {
    font-family: var(--font-body);
    margin: 0;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.25;
  }
  .country-challenge-list-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
  }
  .country-challenge-list-meta,
  .country-challenge-list-stats {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--muted);
    font-size: 10px;
  }
  .country-challenge-list-meta {
    justify-content: space-between;
  }
  .country-challenge-list-meta strong,
  .country-challenge-list-meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .country-challenge-list-meta strong {
    color: var(--text);
  }
  .country-challenge-list-stats {
    gap: 9px;
  }
  .country-challenge-list-stats .country-update-count {
    color: var(--accent);
    font-weight: 720;
  }
  .country-empty p {
    margin: 0;
    color: var(--copy);
    font-size: 13.5px;
    line-height: 1.5;
  }
  .world-country-search-panel {
    display: none;
  }
  .world-country-search-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .world-country-search-label {
    display: block;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
  }
  .world-country-search-control {
    position: relative;
  }
  .world-country-search-control input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px 0 44px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--card);
    color: var(--text);
    outline: none;
  }
  .world-country-search-control input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
  }
  .world-country-search-icon {
    position: absolute;
    z-index: 2;
    left: 14px;
    top: 14px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    color: var(--muted);
    pointer-events: none;
  }
  .world-country-search-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }
  .world-country-search-menu {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    max-height: 210px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--card);
    box-shadow: var(--elevated-shadow);
  }
  .world-country-search-menu.open-up {
    top: auto;
    bottom: calc(100% + 6px);
  }
  .world-country-search-option {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    text-align: left;
  }
  html.is-android-webview .world-country-search-menu {
    max-height: 222px;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  html.is-android-webview .world-country-search-option {
    touch-action: pan-y;
  }
  .world-country-search-option:last-child { border-bottom: 0; }
  .world-country-search-option small { color: var(--muted); white-space: nowrap; }
  .world-country-search-option:hover,
  .world-country-search-option:focus {
    background: var(--soft);
    outline: none;
  }
  .world-country-search-empty {
    padding: 12px;
    color: var(--muted);
    font-size: 13px;
  }
  .world-country-search-status {
    min-height: 42px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
  }
  .world-country-search-status.is-empty {
    display: none;
  }
  .world-country-search-status strong {
    color: var(--text);
    font-size: 13px;
    text-align: right;
  }
  .world-country-challenges-button {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
  }
  .world-country-all-button {
    align-self: flex-start;
    min-height: 34px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .world-country-all-button:hover,
  .world-country-all-button:focus-visible {
    color: var(--text);
    outline: none;
  }

  .world-fullscreen {
    position: relative;
    height: calc(100dvh - var(--topbar-height));
    overflow: hidden;
    background: #05070c;
  }
  .globe-loading-text {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.72);
    font-size: 12px;
    pointer-events: none;
  }
  /* Offene Welt-Popovers bekommen exklusiv den Bedienraum. Die schwebenden
     Erstellen-/Licht-Aktionen verschwinden dabei komplett und koennen weder
     optisch noch per Pointer/Keyboard mit dem offenen Inhalt kollidieren. */
  body.world-view.world-controls-suppressed .world-toolbar,
  body.world-view.world-controls-suppressed .header-primary-actions {
    display: none;
  }

  .world-toolbar {
    position: absolute;
    z-index: 6;
    top: 18px;
    left: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  .world-create-button {
    min-height: 40px;
    gap: 7px;
  }
  /* Browser-only Zusammenfassung der Länder. In der App wird der Button gar
     nicht gerendert; dort übernimmt die Suche unter dem Globus die Navigation. */
  .world-country-summary {
    min-height: 40px;
    margin-left: auto;
    padding-inline: 18px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
  }
  .world-country-summary.is-active {
    border-color: var(--accent);
  }

  .world-create-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }
  .country-overlay {
    position: absolute;
    width: min(400px,calc(100% - 28px));
    overflow-y: auto;
    z-index: 7;
    transform: translateX(calc(100% + 28px));
    visibility: hidden;
    transition: transform .28s ease,visibility .28s;
    top: 18px;
    right: 18px;
    bottom: 18px;
    border: 1px solid rgba(255,255,255,.36);
    border-radius: 0;
    background: rgba(248,248,250,.88);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
    padding: 22px;
  }
  .country-panel-head h2 {
    font-family: var(--font-display);
    margin: 0;
    font-size: 18px;
    font-weight: 650;
  }
  .country-title {
    font-family: var(--font-display);
    margin: 10px 0 8px;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.045em;
    line-height: 1;
    text-transform: uppercase;
  }
  .country-row:hover {
    border-color: var(--accent);
    background: #fff;
  }
  .country-empty {
    display: grid;
    gap: 12px;
    justify-items: start;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: 0;
    border-color: rgba(0,0,0,.14);
    background: rgba(255,255,255,.55);
  }
  .globe-tip {
    display: flex;
    gap: 10px;
    color: #fff;
    padding: 8px 12px;
    font-size: 12.5px;
    line-height: 1.45;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(15,22,34,.80);
    border-radius: 0;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    align-items: center;
  }
  .globe-flag {
    display: grid;
    place-items: center;
    font-size: 24px;
    line-height: 1;
    position: relative;
    width: 30px;
    height: 22px;
    border-radius: 0;
    overflow: hidden;
    background: rgba(255,255,255,.12);
    box-shadow: 0 2px 6px rgba(0,0,0,.28);
    flex: 0 0 auto;
  }
  .globe-flag img, .globe-flag-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
  .globe-flag img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center center;
  }
  .country-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    font-size: 13.5px;
    transition: border-color .15s ease,background .15s ease;
    min-height: 48px;
    border: 0;
    border-radius: 0;
    background: rgba(255,255,255,.72);
    font-weight: 560;
    color: #0a0a0a;
  }
  .globe-tip.globe-tip-flagonly {
    padding: 8px;
    gap: 0;
    border-radius: 0;
  }
  .globe-tip.globe-tip-flagonly>div {
    display: none;
  }
  .globe-tip.globe-tip-flagonly .globe-flag, .globe-tip.globe-tip-flagonly .globe-flag-fallback {
    margin: 0;
  }
  .globe-tip.globe-tip-flagonly .globe-flag {
    width: 34px;
    height: 24px;
  }
  .globe-flag-generic[hidden] {
    display: none;
  }
  .globe-flag-generic {
    position: absolute;
    inset: 0;
    display: block;
    background: rgba(255,255,255,.12);
    overflow: hidden;
  }
  .globe-flag-generic::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 5px;
    width: 15px;
    height: 9px;
    border-radius: 0;
    background: rgba(255,255,255,.82);
    box-shadow: -3px 7px 0 -2px rgba(255,255,255,.65);
  }
  .globe-tip-flagonly .globe-flag-fallback {
    display: none;
  }

  .country-challenge-list-copy .ranking-badge {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
  }
}
