/* === FONT IMPORT === */
@import url('https://fonts.googleapis.com/css2?family=Jersey+10&family=Roboto:wght@400;700&family=Open+Sans:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@500;700&family=Oswald:wght@400;600&family=Raleway:wght@400;700&family=Poppins:wght@400;700&family=Inter:wght@400;700&family=Nunito:wght@400;700&family=Playfair+Display:wght@500;700&family=Merriweather:wght@400;700&family=Anton&family=Bebas+Neue&family=Barlow+Condensed:wght@400;600&family=Orbitron:wght@400;600&display=swap');

/* === ROOT VARIABLES === */
:root {
    --bg-dark: #050505;
    --bg-panel: #0b0b0b;
    --bg-poster: #070707;
    --accent-orange: #f29a1f;
    --accent-orange-dark: #b96d00;
    --accent-cyan: #00d0ff;
    --text-main: #f5f5f5;
    --text-muted: #a3a3a3;
    --radius-lg: 1.25rem;
    --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.35);
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* tunable roles for dropdowns */
    --font-event: "Jersey 10", sans-serif;
    --font-jp: "Jersey 10", sans-serif;
    --font-bodyposter: "Jersey 10", sans-serif;
}

/* === GLOBAL RESET === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top, #151515 0%, #050505 55%, #000 100%);
    color: var(--text-main);
    font-family: var(--font-main);
}

body {
    min-height: 100vh;
}

/* === APP CONTAINER === */
.app-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1.75rem 2rem;
}

/* HEADER */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.brand-jp {
    font-size: 0.9rem;
    color: var(--accent-cyan);
    letter-spacing: 0.25em;
}

.brand-en {
    font-weight: 700;
    letter-spacing: 0.18em;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* CONTROL PANEL TAG */
.header-meta .tag {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--accent-orange);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* LAYOUT GRID */
.app-main {
    display: grid;
    grid-template-columns: minmax(0, 700px) minmax(0, 1fr); /* give panel more width */
    gap: 1.75rem;
    align-items: flex-start;
}

@media (max-width: 960px) {
    .app-main {
        grid-template-columns: 1fr;
    }
}

/* === CONTROL PANEL === */
.control-panel {
    background: linear-gradient(135deg, #050505 0%, #111111 60%, #050505 100%);
    border-radius: var(--radius-lg);
    padding: 1rem 1.2rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.control-panel h2 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.control-panel h3 {
    margin-top: 0.9rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

/* === INPUTS === */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.4rem; /* slightly tighter */
}

input,
textarea {
    background: #050505;
    border-radius: 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.45rem 0.6rem;
    color: var(--text-main);
    font-size: 0.8rem;
}

input:focus,
textarea:focus {
    outline: 1px solid var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.hint {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.field-2col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* SELECTS */
select {
    background: #050505;
    border-radius: 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.35rem 0.55rem; /* slightly slimmer */
    color: var(--text-main);
    font-size: 0.8rem;
}

select:focus {
    outline: 1px solid var(--accent-cyan);
    border-color: var(--accent-cyan);
}

/* TIPS BLOCK */
.tips-block {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: #050505;
    padding: 0.5rem 0.75rem;
}

.tips-block > summary {
    cursor: pointer;
    list-style: none;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tips-block > summary::-webkit-details-marker {
    display: none;
}

.tips-inner {
    margin-top: 0.5rem;
}

.tips-inner code {
    background: #111;
    padding: 0.1rem 0.3rem;
    border-radius: 0.3rem;
    font-size: 0.75rem;
}

/* === POSTER PANEL === */
.poster-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* poster + buttons stay near top */
    position: relative;          /* for rotation handle + toolbox */
}

.poster-wrapper {
    width: 100%;
    max-width: 640px;
    aspect-ratio: 1 / 1; /* default, overridden by JS */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Outer poster container */
.poster {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    background: #000;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    position: relative;
    display: flex;
}

/* TEMPLATE VARIANTS */
.poster.template-classic {
    /* Denki default */
}

/* full background */
.poster.template-fullbg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.poster.template-fullbg .poster-grid {
    background: transparent;
}

.poster.template-fullbg .splash-cell,
.poster.template-fullbg .info-cell,
.poster.template-fullbg .lineup-cell,
.poster.template-fullbg .footer-cell {
    background: transparent;
}

.poster.template-fullbg .poster-stripe {
    display: none;
}

/* minimal */
.poster.template-minimal .poster-stripe {
    display: none;
}

.poster.template-minimal .splash-cell {
    background: #050505;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1.4rem;
}

.poster.template-minimal .logo-splat {
    transform: none;
    padding: 0;
}

/* Main content area */
.poster-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1.05fr 1.1fr;
    grid-template-rows: 1.1fr 0.9fr;
    grid-template-areas:
        "splash info"
        "lineup footer";
}

/* Right-side hazard stripe */
.poster-stripe {
    width: 70px;
    background:
        repeating-linear-gradient(
            -45deg,
            var(--accent-orange) 0 18px,
            #111 18px 36px
        );
}

/* Top-left cell: default splatter asset */
.splash-cell {
    grid-area: splash;
    background: url("../img/BGL.png") center/80% no-repeat,
                #f3e7d1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem;
}

/* container for angled EVENT NAME */
.logo-splat {
    position: relative;
    transform: translate(4%, 6%) rotate(-18deg);
    padding: 0.3rem 0.6rem;
}

/* Event / logo text */
.logo-text {
    display: block;
    font-family: var(--font-event);
    font-size: 3rem;
    text-transform: uppercase;
    color: #fff;
    text-shadow:
        3px 3px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    letter-spacing: 0.16em;
    line-height: 1.05;
}

/* Top-right cell: HERO title + info */
.info-cell {
    grid-area: info;
    background: #050505;
    padding: 1.1rem 1.2rem 0.8rem 1.0rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* HERO + text side-by-side */
.poster-right-top {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

/* HERO stacked title */
.jp-stack {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-family: var(--font-jp);
    font-size: 2.5rem;
    color: var(--accent-cyan);
    text-shadow: 0 0 12px rgba(0, 208, 255, 0.4);
    white-space: nowrap;
}

.date-info {
    flex: 1;
    text-align: right;
}

.date-line {
    font-family: var(--font-bodyposter);
    font-size: 0.9rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-main);
}

.time-note {
    margin-top: 0.25rem;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.info-lines {
    margin-top: 0.5rem;
    font-family: var(--font-bodyposter);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    line-height: 1.6;
}

/* Bottom-left cell: lineup */
.lineup-cell {
    grid-area: lineup;
    background: #050505;
    padding: 1.1rem 1.2rem 1.0rem 1.0rem;
}

.lineup {
    width: 100%;
    font-family: var(--font-bodyposter);
    font-size: 1.05rem;
    line-height: 1.7;
    text-transform: uppercase;
}

/* names + times with nicer spacing */
.lineup-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 2.4rem;
}

.lineup-name {
    letter-spacing: 0.08em;
}

.lineup-time {
    letter-spacing: 0.1em;
}

/* Bottom-right: footer text over black area, not stripes */
.footer-cell {
    grid-area: footer;
    position: absolute;
    bottom: 1.4rem;
    right: 95px;
    z-index: 3;
    background: transparent;
    padding: 0;
    display: flex;
    align-items: flex-end;
}

/* PLUR + copy + code stacked, right-aligned */
.poster-right-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 0.25rem;
}

/* Footer left big text */
.footer-left {
    font-family: var(--font-bodyposter);
    font-size: 1.4rem;
    color: var(--accent-cyan);
    letter-spacing: 0.24em;
}

/* Footer main + extra text */
.footer-center {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
}

.footer-center span:first-child {
    font-family: var(--font-bodyposter);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.footer-jp {
    font-size: 0.75rem;
    color: var(--text-main);
}

/* Code */
.footer-code {
    margin-top: 0.1rem;
    font-family: var(--font-bodyposter);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: var(--text-main);
}

/* EXPORT BUTTONS */
.export-buttons {
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
}

.poster-save-btn {
    padding: 0.5rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--accent-orange);
    background: #050505;
    color: var(--text-main);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s ease-out, transform 0.15s ease-out, border-color 0.15s ease-out;
}

.poster-save-btn:hover {
    background: var(--accent-orange-dark);
    transform: translateY(-1px);
}

.poster-save-btn.secondary {
    border-color: var(--accent-cyan);
}

.poster-save-btn.secondary:hover {
    background: #021922;
}

/* DRAGGABLE / ROTATION */
.draggable-text {
    cursor: move;
    user-select: none;
    position: relative;
}

/* selected draggable text highlight */
.selected-text {
    outline: 1px dashed rgba(0, 208, 255, 0.6);
    outline-offset: 2px;
}

/* rotation handle */
.rotation-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--accent-cyan);
    background: #050505;
    box-shadow: 0 0 8px rgba(0, 208, 255, 0.7);
    cursor: grab;
    z-index: 20;
}

.rotation-handle.hidden {
    display: none;
}

/* TEXT TOOLBOX */
.text-toolbox {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    background: #050505;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.6rem 0.8rem;
    font-size: 0.75rem;
    min-width: 190px;
    box-shadow: var(--shadow-soft);
    display: none;
    z-index: 25;
}

.text-toolbox.visible {
    display: block;
}

.text-toolbox-header {
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}

.text-toolbox label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.4rem;
}

.text-toolbox label span {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.text-toolbox input[type="range"] {
    width: 100%;
}

.text-toolbox button {
    width: 100%;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--accent-cyan);
    background: #050505;
    color: var(--text-main);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.text-toolbox button:hover {
    background: #021922;
}

/* ============================
   Control panel grids
   ============================ */

/* Top: three-column layout for main poster settings */
.control-grid-3 {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr 1.2fr; /* middle column gets more room */
    gap: 1.25rem;
    margin-top: 1rem;
}

.control-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Bottom: three-column layout for Template / Typography / Background */
.control-sections-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr 1.1fr; /* fonts section slightly wider */
    gap: 1.1rem;
    margin-top: 1.25rem;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.control-section h3:first-child {
    margin-top: 0.2rem;
}

/* Make lower section controls a bit more compact */
.control-section .field-group {
    margin-bottom: 0.3rem;
}

.control-section select,
.control-section input,
.control-section textarea {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
}

/* Tips block inside sections gets a bit of space */
.control-section .tips-block {
    margin-top: 0.5rem;
}

/* Mobile fallback */
@media (max-width: 1100px) {
    .control-grid-3,
    .control-sections-grid {
        grid-template-columns: 1fr;
    }
}
