:root {
    --ink: #1d2d2a;
    --muted: #74807a;
    --deep: #173d35;
    --deep-2: #2e6658;
    --gold: #d9c88f;
    --paper: #fbfaf6;
    --panel: #ffffff;
    --line: #e4e7e1;
    --soft: #eef3ef;
    --warm: #f3f0e8;
    --pill: 999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    padding: 56px 72px;
    background: linear-gradient(135deg, #f4f0e7, #edf1ec 52%, #e2ebe6);
    color: var(--ink);
    font-family: Arial, sans-serif;
}

button,
input,
textarea,
a {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    max-width: 1296px;
    min-height: 848px;
    margin: 0 auto;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid #d7ddd4;
    border-radius: 22px;
    box-shadow: 0 18px 48px rgba(32, 49, 46, 0.13);
}

.home-screen {
    max-width: 1296px;
    min-height: 848px;
    margin: 0 auto;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid #d7ddd4;
    border-radius: 22px;
    box-shadow: 0 18px 48px rgba(32, 49, 46, 0.13);
}

.home-topbar,
.home-nav,
.home-actions,
.home-cards {
    display: flex;
    align-items: center;
}

.home-topbar {
    height: 76px;
    padding: 0 46px;
    justify-content: space-between;
    gap: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--line);
}

.home-nav {
    gap: 28px;
    color: #53615b;
    font-size: 14px;
}

.home-nav button,
.home-actions button:first-child {
    background: var(--deep);
    color: #fffdf6;
}

.home-nav button {
    padding: 9px 18px;
    border-radius: var(--pill);
    font-weight: bold;
}

.home-hero {
    min-height: 508px;
    margin: 32px 56px;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 460px;
    align-items: end;
    overflow: hidden;
    background: linear-gradient(180deg, #dfe8e3 0%, #c7d6cf 44%, #173d35 100%);
    border-radius: 24px;
}

.home-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 72% 18%, rgba(217, 200, 143, 0.42), transparent 20%),
        linear-gradient(90deg, rgba(20, 53, 47, 0.05), rgba(20, 53, 47, 0.32));
}

.home-building {
    min-height: 430px;
    position: relative;
    z-index: 1;
    align-self: stretch;
}

.building-body {
    width: 760px;
    height: 238px;
    position: absolute;
    left: 68px;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 34px;
    padding: 54px 72px 38px;
    background: #6e5140;
    border-top: 16px solid #4f3930;
}

.building-body span {
    display: block;
    border-radius: 34px 34px 6px 6px;
    background: linear-gradient(#fff0a9, #a47742);
    box-shadow: inset 0 0 0 7px rgba(23, 61, 53, 0.28);
}

.building-roof {
    width: 830px;
    height: 160px;
    position: absolute;
    left: 32px;
    bottom: 238px;
    background: #334e49;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.building-tower {
    width: 108px;
    height: 250px;
    position: absolute;
    left: 428px;
    bottom: 164px;
    background: #415e57;
    border-top: 46px solid #253d37;
    box-shadow: inset 0 -110px 0 rgba(20, 53, 47, 0.25);
}

.building-tower::after {
    content: "";
    width: 44px;
    height: 98px;
    position: absolute;
    left: 32px;
    top: 72px;
    border-radius: 24px 24px 6px 6px;
    background: linear-gradient(#fff0a9, #a47742);
}

.building-door {
    width: 108px;
    height: 126px;
    position: absolute;
    left: 428px;
    bottom: 0;
    background: var(--deep);
    border-radius: 56px 56px 0 0;
}

.home-copy {
    width: 520px;
    margin: 0 0 42px -170px;
    padding: 36px 38px;
    position: relative;
    z-index: 2;
    background: rgba(251, 250, 246, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(14, 33, 29, 0.22);
}

.home-copy h2 {
    margin-bottom: 14px;
    color: var(--ink);
    font-family: Georgia, serif;
    font-size: 46px;
    line-height: 1.05;
}

.home-copy > p:not(.eyebrow) {
    color: #596861;
    font-size: 16px;
    line-height: 1.6;
}

.home-actions {
    margin-top: 26px;
    gap: 14px;
}

.home-actions button {
    padding: 12px 22px;
    border-radius: var(--pill);
    font-weight: bold;
}

.home-actions button:last-child {
    background: transparent;
    color: var(--deep);
    border: 1px solid rgba(23, 61, 53, 0.25);
}

.home-cards {
    margin: 0 56px 56px;
    gap: 22px;
}

.home-cards article {
    flex: 1;
    min-height: 118px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e0ded4;
    border-radius: 16px;
}

.home-cards span {
    color: var(--gold);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
}

.home-cards h3 {
    margin: 10px 0 8px;
    color: var(--deep);
    font-family: Georgia, serif;
    font-size: 22px;
}

.home-cards p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.topbar,
.brand,
.main-nav,
.user-chip,
.chat-header,
.status-pill,
.chat-input {
    display: flex;
    align-items: center;
}

.topbar {
    height: 72px;
    padding: 0 46px;
    justify-content: space-between;
    gap: 32px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    gap: 14px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: var(--deep);
    color: var(--gold);
    border-radius: 50%;
    font: bold 16px Georgia, serif;
}

.brand h1,
.hero h2,
.panel-header h2 {
    font-family: Georgia, serif;
}

.brand h1 {
    font-size: 23px;
    line-height: 1;
}

.brand p,
.chat-header p,
.panel-header p {
    color: var(--muted);
    font-size: 13px;
}

.brand p {
    margin-top: 6px;
}

.main-nav {
    gap: 30px;
    color: #53615b;
    font-size: 14px;
}

.main-nav .active,
.sanity-card strong {
    color: var(--deep);
    font-weight: bold;
}

.user-chip,
.status-pill {
    gap: 10px;
    background: var(--soft);
    border-radius: var(--pill);
    font-size: 13px;
}

.user-chip {
    padding: 8px 16px;
    color: #2a403b;
}

.user-chip span,
.status-pill span {
    width: 9px;
    height: 9px;
    background: var(--deep-2);
    border-radius: 50%;
}

.hero {
    min-height: 184px;
    margin: 32px 64px 40px;
    padding: 44px 48px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #14352f, #25564b);
    border-radius: 18px;
    color: #fffdf6;
}

.hero::after {
    content: "";
    width: 190px;
    height: 190px;
    position: absolute;
    top: 10px;
    right: 72px;
    border: 1px solid rgba(217, 200, 143, 0.18);
    border-radius: 50%;
}

.eyebrow {
    margin-bottom: 12px;
    color: var(--gold);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.hero h2 {
    margin-bottom: 12px;
    font-size: 42px;
}

.hero p:not(.eyebrow) {
    max-width: 650px;
    color: #dbe7df;
    font-size: 17px;
    line-height: 1.5;
}

.hero button,
.chat-input button {
    background: var(--gold);
    color: var(--deep);
    border-radius: var(--pill);
    font-weight: bold;
}

.hero button {
    margin-top: 24px;
    padding: 11px 28px;
}

.workspace {
    padding: 0 64px 72px;
    display: grid;
    grid-template-columns: 278px 1fr;
    align-items: start;
    gap: 32px;
}

.sidebar,
.chat-panel {
    border-radius: 16px;
}

.sidebar {
    padding: 30px;
    position: sticky;
    top: 24px;
    background: var(--warm);
    border: 1px solid #e0ded4;
}

.section-label {
    margin-bottom: 24px;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.sidebar-item {
    width: 100%;
    margin-bottom: 14px;
    padding: 15px 18px;
    display: block;
    background: var(--panel);
    color: #4d5a55;
    border-radius: 10px;
    text-align: left;
    transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: var(--deep);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(81, 86, 37, 0.28);
}

.sanity-card {
    margin-top: 40px;
    padding: 20px;
    background: #fffdf7;
    border: 1px solid #e0ded4;
    border-radius: 12px;
}

.sanity-card p {
    margin-bottom: 10px;
    color: #718078;
    font-size: 12px;
}

.sanity-card strong {
    display: block;
    margin-bottom: 14px;
    font-size: 25px;
}

.sanity-bar,
.sanity-bar span {
    height: 8px;
    border-radius: var(--pill);
}

.sanity-bar {
    overflow: hidden;
    background: #e5e6df;
}

.sanity-bar span {
    display: block;
    width: 100%;
    background: var(--deep-2);
}

.chat-panel {
    height: 448px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid #e0e5de;
}

.chat-panel.page-mode {
    height: auto;
    min-height: 448px;
    overflow: visible;
}

#tela-consulta,
.screen-panel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

.chat-header {
    padding: 18px 34px;
    justify-content: space-between;
    gap: 24px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.chat-header h3 {
    margin-bottom: 4px;
    font-size: 18px;
}

.chat-header p,
.status-pill {
    font-size: 12px;
}

.status-pill {
    padding: 7px 14px;
    color: #77847e;
}

.status-pill span {
    width: 8px;
    height: 8px;
}

.chat-box {
    flex: 1;
    min-height: 0;
    padding: 30px 34px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.message {
    max-width: 70%;
    padding: 20px 24px;
    border-radius: 14px;
}

.message strong {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
}

.message p {
    color: #43514c;
    font-size: 15px;
    line-height: 1.5;
}

.message.oracle {
    align-self: flex-start;
    background: #f5f3ec;
}

.message.user {
    align-self: flex-end;
    background: var(--deep);
}

.message.user strong {
    color: var(--gold);
}

.message.user p {
    color: #f7f4ea;
}

.chat-input {
    margin: 0 34px 30px;
    padding: 5px;
    gap: 12px;
    background: #f4f6f2;
    border: 1px solid #dfe5dd;
    border-radius: var(--pill);
}

.chat-input input {
    flex: 1;
    padding: 0 22px;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--ink);
}

.chat-input input::placeholder {
    color: #87918c;
}

.chat-input button {
    padding: 9px 28px;
}

.screen-panel {
    padding: 34px;
    overflow-y: auto;
}

.chat-panel.page-mode .screen-panel {
    height: auto;
    min-height: 448px;
    overflow: visible;
}

.panel-header {
    margin-bottom: 26px;
}

.panel-header h2 {
    margin-bottom: 8px;
    color: var(--deep);
    font-size: 30px;
}

.wiki-index {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.wiki-index section,
.note-preview,
.case-card {
    padding: 22px;
    background: #f8f6ef;
    border: 1px solid #e4e0d3;
    border-radius: 14px;
}

.wiki-index h3,
.note-preview h3,
.case-card h3 {
    margin-bottom: 12px;
    color: var(--deep);
    font-size: 16px;
}

.wiki-link-list {
    display: grid;
    gap: 10px;
}

.wiki-link {
    width: 100%;
    padding: 14px;
    background: #fffdf7;
    color: var(--ink);
    border: 1px solid #e4e0d3;
    border-radius: 12px;
    text-align: left;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.wiki-link:hover {
    border-color: rgba(217, 200, 143, 0.9);
    box-shadow: 0 10px 24px rgba(32, 49, 46, 0.1);
    transform: translateY(-2px);
}

.wiki-link span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.wiki-link strong {
    color: var(--deep);
    font-size: 15px;
}

.wiki-detail {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 28px;
    align-items: start;
}

.wiki-back {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 9px 16px;
    background: var(--soft);
    color: var(--deep);
    border-radius: var(--pill);
    font-size: 13px;
    font-weight: bold;
}

.wiki-visual {
    min-height: 320px;
    position: sticky;
    top: 24px;
    display: grid;
    place-items: end start;
    padding: 22px;
    overflow: hidden;
    background: linear-gradient(135deg, #173d35, #d9c88f);
    border-radius: 18px;
}

.wiki-visual::before,
.wiki-visual::after {
    content: "";
    position: absolute;
    border-radius: 50%;
}

.wiki-visual::before {
    width: 190px;
    height: 190px;
    top: 38px;
    left: 34px;
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.wiki-visual::after {
    width: 96px;
    height: 96px;
    right: 28px;
    bottom: 48px;
    background: rgba(255, 255, 255, 0.12);
}

.wiki-visual span {
    position: relative;
    z-index: 1;
    padding: 7px 12px;
    background: rgba(251, 250, 246, 0.84);
    color: var(--deep);
    border-radius: var(--pill);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.wiki-visual.creature {
    background: radial-gradient(circle at 60% 24%, #d9c88f, transparent 26%), linear-gradient(135deg, #13231f, #173d35);
}

.wiki-visual.yellow {
    background: radial-gradient(circle at 80% 18%, #fff2a6, transparent 24%), linear-gradient(135deg, #5d4d1c, #d9c88f);
}

.wiki-visual.void {
    background: radial-gradient(circle at 50% 34%, #5a3d4f, transparent 22%), linear-gradient(135deg, #050505, #1a050c);
}

.wiki-visual.forest {
    background: radial-gradient(circle at 36% 24%, #d9c88f, transparent 20%), linear-gradient(135deg, #183225, #3d5a35);
}

.wiki-visual.gate {
    background: radial-gradient(circle at 50% 42%, transparent 32%, rgba(217, 200, 143, 0.7) 33%, transparent 35%), linear-gradient(135deg, #14352f, #2f3d32);
}

.wiki-visual.city {
    background: linear-gradient(180deg, rgba(20, 53, 47, 0.2), rgba(20, 53, 47, 0.8)), linear-gradient(135deg, #d9c88f, #173d35);
}

.wiki-visual.coast {
    background: radial-gradient(circle at 30% 20%, #dbe7df, transparent 20%), linear-gradient(135deg, #2e6658, #183247);
}

.wiki-visual.field {
    background: linear-gradient(135deg, #615c3a, #173d35);
}

.wiki-visual.mountain {
    background: linear-gradient(145deg, #edf1ec 0 20%, #74807a 20% 36%, #173d35 36% 100%);
}

.wiki-visual.ruin {
    background: linear-gradient(135deg, #7c6a4a, #1d2d2a);
}

.wiki-content {
    padding: 30px;
    background: #fffdf7;
    border: 1px solid #e4e0d3;
    border-radius: 18px;
}

.wiki-content h2 {
    margin-bottom: 18px;
    color: var(--deep);
    font-family: Georgia, serif;
    font-size: 34px;
}

.wiki-content h3 {
    margin-top: 24px;
    margin-bottom: 10px;
    color: var(--deep);
    font-size: 18px;
}

.wiki-content h4 {
    margin-top: 18px;
    margin-bottom: 8px;
    color: #4d5a55;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wiki-content p,
.wiki-content li {
    color: #43514c;
    font-size: 15px;
    line-height: 1.75;
}

.wiki-content ul {
    margin: 10px 0 10px 22px;
}

.notes-field {
    width: 100%;
    min-height: 150px;
    margin-bottom: 22px;
    padding: 18px;
    resize: vertical;
    background: #fffdf7;
    color: var(--ink);
    border: 1px solid #ded8c8;
    border-radius: 14px;
    outline: 0;
    line-height: 1.6;
}

.notes-field:focus {
    border-color: var(--deep-2);
    box-shadow: 0 0 0 3px rgba(46, 102, 88, 0.12);
}

.note-preview p,
.saved-note p,
.case-card p {
    color: #53615b;
    font-size: 14px;
    line-height: 1.6;
}

.notes-list {
    display: grid;
    gap: 14px;
}

.saved-note {
    padding: 18px;
    background: #fffdf7;
    border: 1px solid #e4e0d3;
    border-radius: 12px;
}

.saved-note span {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--deep);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.case-list {
    display: grid;
    gap: 16px;
}

.case-card span {
    display: inline-block;
    margin-bottom: 12px;
    padding: 5px 10px;
    background: var(--soft);
    color: var(--deep);
    border-radius: var(--pill);
    font-size: 12px;
    font-weight: bold;
}

.case-card.active-case {
    border-color: rgba(217, 200, 143, 0.8);
    box-shadow: inset 4px 0 0 var(--gold);
}
